tensorflow/compiler/tf2xla/shape_util.cc
// Convert an XLA Shape into the equivalent TensorFlow shape.
Convert an XLA Shape into the equivalent TensorFlow shape.
Convert an XLA Shape into the equivalent TensorFlow shape .
Status XLAShapeToTensorShape(const xla::Shape& shape,
                             TensorShape* tensor_shape) {
  if (shape.IsTuple()) {
    return errors::InvalidArgument("XLA shape ",
                                   xla::ShapeUtil::HumanString(shape),
                                   " cannot be converted to a TensorShape");
  }
  *tensor_shape = TensorShape();
  for (int i = 0; i < shape.rank(); ++i) {
    tensor_shape->AddDim(shape.dimensions(i));
  }
  return Status::OK();
}
Status XLAShapeToTensorShape ( const xla :: Shape & shape , TensorShape * tensor_shape ) { if ( shape . IsTuple ( ) ) { return errors :: InvalidArgument ( " " , xla :: ShapeUtil :: HumanString ( shape ) , " " ) ; } * tensor_shape = TensorShape ( ) ; for ( int i = 0 ; i < shape . rank ( ) ; ++ i ) { tensor_shape -> AddDim ( shape . dimensions ( i ) ) ; } return Status :: OK ( ) ; }
Convert an XLA Shape into the equivalent TensorFlow shape.
Convert an XLA Shape into the equivalent TensorFlow shape .