@@ -580,6 +580,36 @@ TEST(PrintingTest, TensoVector) {
580580 EXPECT_EQ (absl::StrFormat (" %v" , tensors), " (3d_i32<2x2x2>,3d_i32<2x2x2>)" );
581581}
582582
583+ TEST (PrintingTest, Op) {
584+ LiteRtOpT op;
585+ op.SetOpCode (kLiteRtOpCodeTflAdd );
586+
587+ {
588+ ::tflite::AddOptionsT add_opts;
589+ add_opts.fused_activation_function = ::tflite::ActivationFunctionType_RELU;
590+ add_opts.pot_scale_int16 = false ;
591+ TflOptions opts;
592+ opts.type = ::tflite::BuiltinOptions_AddOptions;
593+ opts.Set (std::move (add_opts));
594+ litert::internal::SetTflOptions (op, std::move (opts));
595+ }
596+
597+ LiteRtTensorT tensor;
598+ tensor.SetType (MakeRankedTensorType (kLiteRtElementTypeInt32 , {2 , 2 , 2 }));
599+ op.Inputs ().push_back (&tensor);
600+
601+ LiteRtTensorT tensor2;
602+ tensor2.SetType (MakeRankedTensorType (kLiteRtElementTypeInt32 , {2 }));
603+ op.Inputs ().push_back (&tensor2);
604+
605+ LiteRtTensorT tensor3;
606+ tensor3.SetType (MakeRankedTensorType (kLiteRtElementTypeInt32 , {2 , 2 , 2 }));
607+ op.Outputs ().push_back (&tensor3);
608+
609+ EXPECT_EQ (absl::StrFormat (" %v" , op),
610+ " tfl.add{fa=RELU}(3d_i32<2x2x2>,1d_i32<2>)->(3d_i32<2x2x2>)" );
611+ }
612+
583613TEST (PrintingTest, TflOptions) {
584614 TflOptions opts;
585615 opts.type = ::tflite::BuiltinOptions_AddOptions;
0 commit comments