Returns this shape as a `TensorShapeProto`.
(self)
| 1172 | return [dim.value for dim in self._dims] |
| 1173 | |
| 1174 | def as_proto(self): |
| 1175 | """Returns this shape as a `TensorShapeProto`.""" |
| 1176 | if self._dims is None: |
| 1177 | return tensor_shape_pb2.TensorShapeProto(unknown_rank=True) |
| 1178 | else: |
| 1179 | return tensor_shape_pb2.TensorShapeProto(dim=[ |
| 1180 | tensor_shape_pb2.TensorShapeProto.Dim( |
| 1181 | size=-1 if d.value is None else d.value) for d in self._dims |
| 1182 | ]) |
| 1183 | |
| 1184 | def __eq__(self, other): |
| 1185 | """Returns True if `self` is equivalent to `other`.""" |