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

Function ShapeProtoToVec

tensorflow/core/profiler/internal/tfprof_node.cc:265–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265std::vector<int64> ShapeProtoToVec(const TensorShapeProto& shape_pb) {
266 std::vector<int64> shape_vec;
267 if (shape_pb.dim_size() == 0 && !shape_pb.unknown_rank()) {
268 // Scalar parameter with empty shape but known rank.
269 shape_vec.push_back(1);
270 } else {
271 for (const auto& d : shape_pb.dim()) {
272 shape_vec.push_back(d.size());
273 }
274 }
275 return shape_vec;
276}
277
278TensorShapeProto VecToShapeProto(const std::vector<int64>& shape_vec) {
279 TensorShapeProto shape_pb;

Callers 2

TFGraphNodeMethod · 0.85
FormatInputShapesMethod · 0.85

Calls 5

unknown_rankMethod · 0.80
dim_sizeMethod · 0.45
push_backMethod · 0.45
dimMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected