parameters: (self, value, expand_shape=False)
return_statement: return np.reshape(value, self._shape)
docstring: Reshape for value when `shape` is not None.
docstring_summary: Reshape for value when `shape` is not None.
docstring_tokens: Reshape for value when shape is not None .
function: def _reshape(self, value, expand_shape=False):
      """ Reshape for value when `shape` is not None.
      """
      if value is None or not value.size:
        return value
      if not isinstance(value, np.ndarray):
        raise ValueError("{} must be a numpy.ndarray.".format(value))
      if not self._shape:
        return value
      if not isinstance(self._shape, tuple):
        raise ValueError("shape must be a tuple, got {}." .format(self._shape))
      if expand_shape:
        return np.reshape(value, self._shape + (-1, ))  # pylint: disable=bad-whitespace
      return np.reshape(value, self._shape)
function_tokens: def _reshape ( self , value , expand_shape = False ) : if value is None or not value . size : return value if not isinstance ( value , np . ndarray ) : raise ValueError ( "{} must be a numpy.ndarray." . format ( value ) ) if not self . _shape : return value if not isinstance ( self . _shape , tuple ) : raise ValueError ( "shape must be a tuple, got {}." . format ( self . _shape ) ) if expand_shape : return np . reshape ( value , self . _shape + ( - 1 , ) ) # pylint: disable=bad-whitespace return np . reshape ( value , self . _shape )