diff options
author | A. Unique TensorFlower <gardener@tensorflow.org> | 2016-08-18 15:13:30 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-08-18 16:17:45 -0700 |
commit | ee76f57f7aa07825592fce30ee2d7db706682498 (patch) | |
tree | 252a9e0b2814980b02fd9be3ed2e3e4c7c304480 /tensorflow/contrib/quantization | |
parent | 5fc225a20e581eb012466593ad3dc4694757d681 (diff) |
Automated rollback of change 130687505
Change: 130694711
Diffstat (limited to 'tensorflow/contrib/quantization')
-rw-r--r-- | tensorflow/contrib/quantization/kernels/hexagon/BUILD | 44 | ||||
-rw-r--r-- | tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc | 94 |
2 files changed, 0 insertions, 138 deletions
diff --git a/tensorflow/contrib/quantization/kernels/hexagon/BUILD b/tensorflow/contrib/quantization/kernels/hexagon/BUILD deleted file mode 100644 index 18afb68989..0000000000 --- a/tensorflow/contrib/quantization/kernels/hexagon/BUILD +++ /dev/null @@ -1,44 +0,0 @@ -# Description: -# quantization-specific OpKernels for hexagon - -package( - default_visibility = ["//visibility:public"], - features = ["-parse_headers"], -) - -licenses(["notice"]) # Apache 2.0 - -load( - "//tensorflow:tensorflow.bzl", - "tf_cc_test", -) - -filegroup( - name = "all_files", - srcs = glob( - ["**/*"], - exclude = [ - "**/METADATA", - "**/OWNERS", - ], - ), - visibility = ["//tensorflow:__subpackages__"], -) - -tf_cc_test( - name = "quantized_matmul_op_for_hexagon_test", - size = "small", - deps = [ - "//tensorflow/contrib/quantization:cc_array_ops", - "//tensorflow/contrib/quantization:cc_math_ops", - "//tensorflow/contrib/quantization:cc_nn_ops", - "//tensorflow/contrib/quantization/kernels:quantized_ops", - "//tensorflow/core:framework", - "//tensorflow/core:protos_all", - "//tensorflow/core:test", - "//tensorflow/core:test_main", - "//tensorflow/core:testlib", - "//tensorflow/core/kernels:ops_testutil", - "//tensorflow/core/kernels:ops_util", - ], -) diff --git a/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc b/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc deleted file mode 100644 index 1fa4ba0163..0000000000 --- a/tensorflow/contrib/quantization/kernels/hexagon/quantized_matmul_op_for_hexagon_test.cc +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2016 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. -==============================================================================*/ -// Tests in this file are designed to evaluate hexagon DSP operations. - -#include "tensorflow/contrib/quantization/kernels/quantization_utils.h" -#include "tensorflow/core/framework/allocator.h" -#include "tensorflow/core/framework/fake_input.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/node_def_builder.h" -#include "tensorflow/core/framework/op_kernel.h" -#include "tensorflow/core/framework/tensor.h" -#include "tensorflow/core/framework/tensor_testutil.h" -#include "tensorflow/core/framework/types.h" -#include "tensorflow/core/framework/types.pb.h" -#include "tensorflow/core/kernels/ops_testutil.h" -#include "tensorflow/core/kernels/ops_util.h" -#include "tensorflow/core/lib/core/status_test_util.h" -#include "tensorflow/core/platform/test.h" - -#ifdef USE_HEXAGON_LIBS -#include "gemm_wrapper.h" -#endif - -namespace tensorflow { - -class QuantizedMatMulOpForHexagonTest : public OpsTestBase { - protected: - void SetUp() final { -#ifdef USE_HEXAGON_LIBS - LOG(INFO) << "Hexagon libs are linked (version = " - << hexagon_gemm_wrapper_GetVersion() << ")"; -#else - LOG(WARNING) << "Hexagon libs are not linked."; -#endif - } -}; - -// Runs two small matrices through the operator, and leaves all the parameters -// at their default values. -// This test is a sample to execute matmul on hexagon. -TEST_F(QuantizedMatMulOpForHexagonTest, Small_NoParams) { - TF_ASSERT_OK(NodeDefBuilder("quantized_mat_mul_op", "QuantizedMatMul") - .Input(FakeInput(DT_QUINT8)) - .Input(FakeInput(DT_QUINT8)) - .Input(FakeInput(DT_FLOAT)) - .Input(FakeInput(DT_FLOAT)) - .Input(FakeInput(DT_FLOAT)) - .Input(FakeInput(DT_FLOAT)) - .Attr("Toutput", DataTypeToEnum<qint32>::v()) - .Finalize(node_def())); - TF_ASSERT_OK(InitOp()); - // A matrix is: - // | 1 | 2 | 3 | - // | 4 | 5 | 6 | - AddInputFromArray<quint8>(TensorShape({2, 3}), {1, 2, 3, 4, 5, 6}); - // B matrix is: - // | 7 | 8 | 9 | 10 | - // | 11 | 12 | 13 | 14 | - // | 15 | 16 | 17 | 18 | - AddInputFromArray<quint8>(TensorShape({3, 4}), - {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18}); - AddInputFromArray<float>(TensorShape({1}), {0}); - AddInputFromArray<float>(TensorShape({1}), {255.0f}); - AddInputFromArray<float>(TensorShape({1}), {0}); - AddInputFromArray<float>(TensorShape({1}), {255.0f}); - - TF_ASSERT_OK(RunOpKernel()); - // Here are the results we expect, from hand calculations: - // (1 * 7) + (2 * 11) + (3 * 15) = 74 - // (1 * 8) + (2 * 12) + (3 * 16) = 80 - // (1 * 9) + (2 * 13) + (3 * 17) = 86 - // (1 * 10) + (2 * 14) + (3 * 18) = 92 - // (4 * 7) + (5 * 11) + (6 * 15) = 173 - // (4 * 8) + (5 * 12) + (6 * 16) = 188 - // (4 * 9) + (5 * 13) + (6 * 17) = 203 - // (4 * 10) + (5 * 14) + (6 * 18) = 218 - Tensor expected(allocator(), DT_QINT32, TensorShape({2, 4})); - test::FillValues<qint32>(&expected, {74, 80, 86, 92, 173, 188, 203, 218}); - test::ExpectTensorEqual<qint32>(expected, *GetOutput(0)); -} - -} // namespace tensorflow |