code: def as_proto(self):
          
          if self._dims is None:
              return tensor_shape_pb2.TensorShapeProto(unknown_rank=True)
          else:
              return tensor_shape_pb2.TensorShapeProto(
                  dim=[
                      tensor_shape_pb2.TensorShapeProto.Dim(
                          size=-1 if d.value is None else d.value
                      )
                      for d in self._dims
                  ]
              )
docs: Returns this shape as a `TensorShapeProto`.