STT-tensorflow/tensorflow/lite/tools/tool_params_test.cc
A. Unique TensorFlower e25d3e084b Merged commit includes the following changes:
319411158  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Integrate LLVM at https://github.com/llvm/llvm-project/commit/d6343e607ac8

--
319410296  by A. Unique TensorFlower<gardener@tensorflow.org>:

    [XLA] Implement extra prefetch limit for while uses.

    Outstanding prefetch limits can prevent prefetches from being scheduled for
    the duration of while loops. Since using alternate memory for the while loops
    can be more beneficial, allow specifying additional prefetch limit when the use
    is a while HLO.

--
319406145  by A. Unique TensorFlower<gardener@tensorflow.org>:

    [XLA:CPU] Teach dot_op_emitter how to tile&vectorize linalg matmuls

    And turn them on by default.

    This is on-par with the existing emitter, sometimes better and unlocks more
    potential. The strategy classes are duplicated right now, but I expect them to
    graduate to mlir core soon.

    I'm planning to remove the custom LLVM IR emitters if this turns out to be
    stable enough.

--
319402982  by A. Unique TensorFlower<gardener@tensorflow.org>:

    PR #40327: [ROCm] Enabling optimized FusedBatchNormInferenceMetaKernel for half

    Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/40327

    This PR enables optimized FusedBatchNormInferenceMetaKernel for half on ROCm.
    Copybara import of the project:

    --
    5f658e2bc1b20794239658bffe0d7bf9cb89c81f by Eugene Kuznetsov <eugene.kuznetsov@amd.com>:

    Enabling optimized FusedBatchNormInferenceMetaKernel for half

--
319393611  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Integrate LLVM at https://github.com/llvm/llvm-project/commit/68498ce8af37

--
319374663  by A. Unique TensorFlower<gardener@tensorflow.org>:

    compat: Update forward compatibility horizon to 2020-07-02

--
319374662  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update GraphDef version to 450.

--
319371388  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Update framework_build_test targets

--
319363982  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Resolve the permission denied error on Python 3.7 pip install.

--
319361498  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Add an option to only log parameters whose values are parsed from cmdline flags in the benchmark tool.

--
319356677  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Fix bug in ReadNonConstantTensor

    assigning new value to the reference don't update the reference, so use pointer instead.

--
319350974  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Fix the header inclusion path issue with TensorFlowLiteC

--
319342653  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Fix the relationship between tpu_executor and tpu_executor_base build targets.

--
319342578  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal change

319340968  by A. Unique TensorFlower<gardener@tensorflow.org>:

    Internal change

PiperOrigin-RevId: 319411158
2020-07-02 10:46:26 -07:00

76 lines
2.5 KiB
C++

/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/lite/tools/tool_params.h"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
namespace tflite {
namespace tools {
namespace {
TEST(ToolParams, SetTest) {
ToolParams params;
params.AddParam("some-int1", ToolParam::Create<int>(13));
params.AddParam("some-int2", ToolParam::Create<int>(17));
ToolParams others;
others.AddParam("some-int1", ToolParam::Create<int>(19));
others.AddParam("some-bool", ToolParam::Create<bool>(true));
params.Set(others);
EXPECT_EQ(19, params.Get<int>("some-int1"));
EXPECT_TRUE(params.HasValueSet<int>("some-int1"));
EXPECT_EQ(17, params.Get<int>("some-int2"));
EXPECT_FALSE(params.HasValueSet<int>("some-int2"));
EXPECT_FALSE(params.HasParam("some-bool"));
}
TEST(ToolParams, MergeTestOverwriteTrue) {
ToolParams params;
params.AddParam("some-int1", ToolParam::Create<int>(13));
params.AddParam("some-int2", ToolParam::Create<int>(17));
ToolParams others;
others.AddParam("some-int1", ToolParam::Create<int>(19));
others.AddParam("some-bool", ToolParam::Create<bool>(true));
params.Merge(others, true /* overwrite */);
EXPECT_EQ(19, params.Get<int>("some-int1"));
EXPECT_EQ(17, params.Get<int>("some-int2"));
EXPECT_TRUE(params.Get<bool>("some-bool"));
}
TEST(ToolParams, MergeTestOverwriteFalse) {
ToolParams params;
params.AddParam("some-int1", ToolParam::Create<int>(13));
params.AddParam("some-int2", ToolParam::Create<int>(17));
ToolParams others;
others.AddParam("some-int1", ToolParam::Create<int>(19));
others.AddParam("some-bool", ToolParam::Create<bool>(true));
params.Merge(others); // default overwrite is false
EXPECT_EQ(13, params.Get<int>("some-int1"));
EXPECT_EQ(17, params.Get<int>("some-int2"));
EXPECT_TRUE(params.Get<bool>("some-bool"));
}
} // namespace
} // namespace tools
} // namespace tflite