class_docstr: Represents the shape of a `Tensor`.
  
  A `TensorShape` represents a possibly-partial shape specification for a
  `Tensor`. It may be one of the following:
  
  * *Fully-known shape:* has a known number of dimensions and a known size
    for each dimension. e.g. `TensorShape([16, 256])`
  * *Partially-known shape:* has a known number of dimensions, and an unknown
    size for one or more dimension. e.g. `TensorShape([None, 256])`
  * *Unknown shape:* has an unknown number of dimensions, and an unknown
    size in all dimensions. e.g. `TensorShape(None)`
  
  If a tensor is produced by an operation of type `"Foo"`, its shape
  may be inferred if there is a registered shape function for
  `"Foo"`. See @{$adding_an_op#shape-functions-in-c$`Shape functions in C++`}
  for details of shape functions and how to register them. Alternatively,
  the shape may be set explicitly using @{tf.Tensor.set_shape}.
class_docstr_tok: ["Represents","the","shape","of","a","`","Tensor","`",".","A","`","TensorShape","`","represents","a","possibly-partial","shape","specification","for","a","`","Tensor","`",".","It","may","be","one","of","the","following",":","*","*","Fully-known","shape",":","*","has","a","known","number","of","dimensions","and","a","known","size","for","each","dimension",".","e.g",".","`","TensorShape","(","[","16",",","256","]",")","`","*","*","Partially-known","shape",":","*","has","a","known","number","of","dimensions",",","and","an","unknown","size","for","one","or","more","dimension",".","e.g",".","`","TensorShape","(","[","None",",","256","]",")","`","*","*","Unknown","shape",":","*","has","an","unknown","number","of","dimensions",",","and","an","unknown","size","in","all","dimensions",".","e.g",".","`","TensorShape","(","None",")","`","If","a","tensor","is","produced","by","an","operation","of","type","`","``","Foo","''","`",",","its","shape","may","be","inferred","if","there","is","a","registered","shape","function","for","`","``","Foo","''","`",".","See","@","{","$","adding_an_op","#","shape-functions-in-c","$","`","Shape","functions","in","C++","`","}","for","details","of","shape","functions","and","how","to","register","them",".","Alternatively",",","the","shape","may","be","set","explicitly","using","@","{","tf.Tensor.set_shape","}","."]
docstr: Creates a new TensorShape with the given dimensions.
  
  Args:
    dims: A list of Dimensions, or None if the shape is unspecified.
      DEPRECATED: A single integer is treated as a singleton list.
  
  Raises:
    TypeError: If dims cannot be converted to a list of dimensions.
docstr_tok: ["Creates","a","new","TensorShape","with","the","given","dimensions",".","Args",":","dims",":","A","list","of","Dimensions",",","or","None","if","the","shape","is","unspecified",".","DEPRECATED",":","A","single","integer","is","treated","as","a","singleton","list",".","Raises",":","TypeError",":","If","dims","can","not","be","converted","to","a","list","of","dimensions","."]
code: def __init__(self, dims):
      """Creates a new TensorShape with the given dimensions.
  
      Args:
        dims: A list of Dimensions, or None if the shape is unspecified.
          DEPRECATED: A single integer is treated as a singleton list.
  
      Raises:
        TypeError: If dims cannot be converted to a list of dimensions.
      """
      # TODO(irving): Eliminate the single integer special case.
      if dims is None:
          self._dims = None
      elif isinstance(dims, compat.bytes_or_text_types):
          raise TypeError(
              "A string has ambiguous TensorShape, please wrap in a "
              "list or convert to an int: %s" % dims
          )
      elif isinstance(dims, tensor_shape_pb2.TensorShapeProto):
          if dims.unknown_rank:
              self._dims = None
          else:
              self._dims = [
                  # Protos store variable-size dimensions as -1
                  as_dimension(dim.size if dim.size != -1 else None)
                  for dim in dims.dim
              ]
      elif isinstance(dims, TensorShape):
          self._dims = dims.dims
      else:
          try:
              dims_iter = iter(dims)
          except TypeError:
              # Treat as a singleton dimension
              self._dims = [as_dimension(dims)]
          else:
              # Got a list of dimensions
              self._dims = [as_dimension(d) for d in dims_iter]
      self._ndims = None
  
imports: from .None import compat, dtypes
  from tensorboard.compat.proto import tensor_shape_pb2
label_desc: Use image node_id 1 to create a new TensorShape object  with example: obj = TensorShape(dims)