MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SimpleMulVersioningTest

Function SimpleMulVersioningTest

tensorflow/lite/toco/tflite/operator_test.cc:920–942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918TEST_F(OperatorTest, VersioningSubTest) { SimpleVersioningTest<SubOperator>(); }
919
920void SimpleMulVersioningTest(ArrayDataType data_type, float multiplier,
921 int version) {
922 MulOperator op;
923 op.inputs = {"input1", "input2"};
924 op.outputs = {"output"};
925 auto operator_by_type_map = BuildOperatorByTypeMap(false /*enable_flex_ops*/);
926 const BaseOperator* base_op = operator_by_type_map.at(op.type).get();
927
928 Model model;
929 Array& input0 = model.GetOrCreateArray(op.inputs[0]);
930 Array& input1 = model.GetOrCreateArray(op.inputs[1]);
931 Array& output = model.GetOrCreateArray(op.outputs[0]);
932
933 input0.data_type = data_type;
934 input0.GetOrCreateQuantizationParams().scale = 1.0f;
935 input1.data_type = data_type;
936 input1.GetOrCreateQuantizationParams().scale = 1.0f;
937 output.data_type = data_type;
938 output.GetOrCreateQuantizationParams().scale = 1.0f / multiplier;
939
940 OperatorSignature signature = {.op = &op, .model = &model};
941 EXPECT_EQ(base_op->GetVersion(signature), version);
942}
943
944TEST_F(OperatorTest, VersioningMulTest) {
945 SimpleMulVersioningTest(ArrayDataType::kUint8, 0.5f, 1);

Callers 1

TEST_FFunction · 0.85

Calls 4

BuildOperatorByTypeMapFunction · 0.85
getMethod · 0.45
atMethod · 0.45
GetVersionMethod · 0.45

Tested by

no test coverage detected