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

Function CreateTestGraph

tensorflow/tools/benchmark/benchmark_model_test.cc:29–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace {
28
29void CreateTestGraph(const ::tensorflow::Scope& root,
30 benchmark_model::InputLayerInfo* input,
31 string* output_name, GraphDef* graph_def) {
32 // Create a simple graph and write it to filename_pb.
33 const int input_width = 400;
34 const int input_height = 10;
35 input->shape = TensorShape({input_width, input_height});
36 input->data_type = DT_FLOAT;
37 const TensorShape constant_shape({input_height, input_width});
38
39 Tensor constant_tensor(DT_FLOAT, constant_shape);
40 test::FillFn<float>(&constant_tensor, [](int) -> float { return 3.0; });
41
42 auto placeholder =
43 ops::Placeholder(root, DT_FLOAT, ops::Placeholder::Shape(input->shape));
44 input->name = placeholder.node()->name();
45 auto m = ops::MatMul(root, placeholder, constant_tensor);
46 *output_name = m.node()->name();
47 TF_ASSERT_OK(root.ToGraphDef(graph_def));
48}
49
50TEST(BenchmarkModelTest, InitializeAndRun) {
51 const string dir = testing::TmpDir();

Callers 1

TESTFunction · 0.85

Calls 7

nameMethod · 0.65
TensorShapeClass · 0.50
PlaceholderFunction · 0.50
ShapeStruct · 0.50
MatMulFunction · 0.50
nodeMethod · 0.45
ToGraphDefMethod · 0.45

Tested by

no test coverage detected