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

Function MakeDenseShapes

tensorflow/core/ops/parsing_ops_test.cc:65–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65static std::vector<PartialTensorShape> MakeDenseShapes(int size,
66 bool add_extra_shape,
67 int unknown_outer_dims) {
68 std::vector<PartialTensorShape> shapes(size);
69 for (int i = 0; i < size; ++i) {
70 // Make shapes be the sequence [?,1]; [?,1,2], [?,1,2,3]...
71 // where the number of prefixed ? depends on unknown_outer_dims.
72 if (i == 0) {
73 shapes[i].Clear();
74 for (int d = 0; d < unknown_outer_dims; ++d) {
75 shapes[i].AddDim(-1);
76 }
77 } else {
78 shapes[i] = shapes[i - 1];
79 }
80 shapes[i].AddDim(i + 1);
81 }
82 if (add_extra_shape) shapes.push_back(PartialTensorShape({}));
83 return shapes;
84}
85
86TEST(ParsingOpsTest, ParseExample_ShapeFn) {
87 ShapeInferenceTestOp op("ParseExample");

Callers 1

TESTFunction · 0.85

Calls 4

PartialTensorShapeClass · 0.85
ClearMethod · 0.45
AddDimMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected