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

Function SimpleVersioningTest

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

Source from the content-addressed store, hash-verified

756// version.
757template <typename Op>
758void SimpleVersioningTest() {
759 Op op;
760 op.inputs = {"input1"};
761 auto operator_by_type_map = BuildOperatorByTypeMap(false /*enable_flex_ops*/);
762 const BaseOperator* base_op = operator_by_type_map.at(op.type).get();
763
764 Model uint8_model;
765 Array& uint8_array = uint8_model.GetOrCreateArray(op.inputs[0]);
766 uint8_array.data_type = ArrayDataType::kUint8;
767 OperatorSignature uint8_signature = {.op = &op, .model = &uint8_model};
768 EXPECT_EQ(base_op->GetVersion(uint8_signature), 1);
769
770 Model int8_model;
771 Array& int8_array = int8_model.GetOrCreateArray(op.inputs[0]);
772 int8_array.data_type = ArrayDataType::kInt8;
773 OperatorSignature int8_signature = {.op = &op, .model = &int8_model};
774 EXPECT_EQ(base_op->GetVersion(int8_signature), 2);
775}
776
777// Test version for a simple Op with 2 versions and the output type controls the
778// version.

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected