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

Function TEST_F

tensorflow/core/kernels/summary_tensor_op_test.cc:61–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59};
60
61TEST_F(SummaryTensorOpV2Test, BasicPluginData) {
62 MakeOp();
63
64 // Feed and run
65 AddInputFromArray<tstring>(TensorShape({}), {"tag_foo"});
66 AddInputFromArray<tstring>(TensorShape({}), {"some string tensor content"});
67
68 // Create a SummaryMetadata that stores data for 2 plugins.
69 SummaryMetadata summary_metadata;
70 SummaryMetadata::PluginData* plugin_data =
71 summary_metadata.mutable_plugin_data();
72 plugin_data->set_plugin_name("foo");
73 plugin_data->set_content("content_for_plugin_foo");
74 AddInputFromArray<tstring>(TensorShape({}),
75 {summary_metadata.SerializeAsString()});
76
77 TF_ASSERT_OK(RunOpKernel());
78
79 // Check the output size.
80 Tensor* out_tensor = GetOutput(0);
81 ASSERT_EQ(0, out_tensor->dims());
82 Summary summary;
83 ParseProtoUnlimited(&summary, out_tensor->scalar<tstring>()());
84 ASSERT_EQ(1, summary.value_size());
85
86 // Check the content of the tensor stored in the summary.
87 Tensor string_content_tensor;
88 CHECK(string_content_tensor.FromProto(summary.value(0).tensor()));
89 ASSERT_EQ("some string tensor content",
90 string_content_tensor.scalar<tstring>()());
91
92 // Check plugin-related data.
93 ASSERT_EQ("tag_foo", summary.value(0).tag());
94 ASSERT_EQ("foo", summary.value(0).metadata().plugin_data().plugin_name());
95 ASSERT_EQ("content_for_plugin_foo",
96 summary.value(0).metadata().plugin_data().content());
97}
98
99} // namespace
100} // namespace tensorflow

Callers

nothing calls this directly

Calls 11

GetOutputFunction · 0.85
ParseProtoUnlimitedFunction · 0.85
tagMethod · 0.80
metadataMethod · 0.80
contentMethod · 0.80
TensorShapeClass · 0.50
SerializeAsStringMethod · 0.45
dimsMethod · 0.45
FromProtoMethod · 0.45
tensorMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected