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

Function XLAShapeToTensorShape

tensorflow/compiler/tf2xla/shape_util.cc:87–99  ·  view source on GitHub ↗

Convert an XLA Shape into the equivalent TensorFlow shape.

Source from the content-addressed store, hash-verified

85
86// Convert an XLA Shape into the equivalent TensorFlow shape.
87Status XLAShapeToTensorShape(const xla::Shape& shape,
88 TensorShape* tensor_shape) {
89 if (shape.IsTuple()) {
90 return errors::InvalidArgument("XLA shape ",
91 xla::ShapeUtil::HumanString(shape),
92 " cannot be converted to a TensorShape");
93 }
94 *tensor_shape = TensorShape();
95 for (int i = 0; i < shape.rank(); ++i) {
96 tensor_shape->AddDim(shape.dimensions(i));
97 }
98 return Status::OK();
99}
100
101// Convert a TensorShape into the equivalent XLA Shape proto.
102Status TensorShapeToXLAShape(DataType dtype, const TensorShape& tensor_shape,

Callers 15

ComputeMethod · 0.85
GetOutputInfoFunction · 0.85
LiteralToHostTensorFunction · 0.85
CompileFunctionMethod · 0.85
XLAShapeForArgumentMethod · 0.85
AssignVariableTensorFunction · 0.85
GetShapeMethod · 0.85
BroadcastOpsToSameFunction · 0.85
GetStackShapeFunction · 0.85
CompileMethod · 0.85

Calls 6

InvalidArgumentFunction · 0.85
TensorShapeClass · 0.50
IsTupleMethod · 0.45
rankMethod · 0.45
AddDimMethod · 0.45
dimensionsMethod · 0.45

Tested by

no test coverage detected