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

Function ShapeHandleToTensorShape

tensorflow/compiler/jit/shape_inference.cc:29–40  ·  view source on GitHub ↗

Converts a shape inference handle to a PartialTensorShape.

Source from the content-addressed store, hash-verified

27
28// Converts a shape inference handle to a PartialTensorShape.
29Status ShapeHandleToTensorShape(shape_inference::InferenceContext* context,
30 const shape_inference::ShapeHandle& handle,
31 PartialTensorShape* shape) {
32 // The default is already unknown
33 if (!context->RankKnown(handle)) return Status::OK();
34
35 std::vector<int64> dims(context->Rank(handle));
36 for (int32 i = 0; i < dims.size(); ++i) {
37 dims[i] = context->Value(context->Dim(handle, i));
38 }
39 return PartialTensorShape::MakePartialShape(dims.data(), dims.size(), shape);
40}
41
42Status PropagateShapes(const Graph& graph,
43 const std::map<int, InferredShape>& arg_shapes,

Callers 1

StoreOutputShapesFunction · 0.70

Calls 6

RankKnownMethod · 0.80
RankMethod · 0.45
sizeMethod · 0.45
ValueMethod · 0.45
DimMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected