Convert an XLA Shape into the equivalent TensorFlow shape.
| 85 | |
| 86 | // Convert an XLA Shape into the equivalent TensorFlow shape. |
| 87 | Status 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. |
| 102 | Status TensorShapeToXLAShape(DataType dtype, const TensorShape& tensor_shape, |
no test coverage detected