(self, *shape)
return self.__class__(
            backend=self.backend,
            ary=ary,
            dtype=self._tensor.dtype,
            base=self)
Return a reshaped view.
Return a reshaped view.
Return a reshaped view .
def reshape(self, *shape):
        """
        Return a reshaped view.
        """
        if isinstance(shape[0], (tuple, list)):
            shape = tuple(shape[0])

        if shape == self.shape:
            return self

        try:
            ary = self._tensor.reshape(shape)
        except ValueError:
            def product(vec):
                return functools.reduce(lambda x, y: x * y, vec)

            raise ValueError((
                'The total size of a reshaped tensor must be the same as its '
                'existing size. Tensor is currently shape {current_shape} '
                'and size {current_size}. Attempted to reshape to '
                '{reshape_shape} which would be size {reshape_size}.'
            ).format(
                current_shape=self._tensor.shape,
                current_size=product(self._tensor.shape),
                reshape_shape=shape,
                reshape_size=product(shape),
            ))

        return self.__class__(
            backend=self.backend,
            ary=ary,
            dtype=self._tensor.dtype,
            base=self)
def reshape ( self , * shape ) : if isinstance ( shape [ 0 ] , ( tuple , list ) ) : shape = tuple ( shape [ 0 ] ) if shape == self . shape : return self try : ary = self . _tensor . reshape ( shape ) except ValueError : def product ( vec ) : return functools . reduce ( lambda x , y : x * y , vec ) raise ValueError ( ( 'The total size of a reshaped tensor must be the same as its ' 'existing size. Tensor is currently shape {current_shape} ' 'and size {current_size}. Attempted to reshape to ' '{reshape_shape} which would be size {reshape_size}.' ) . format ( current_shape = self . _tensor . shape , current_size = product ( self . _tensor . shape ) , reshape_shape = shape , reshape_size = product ( shape ) , ) ) return self . __class__ ( backend = self . backend , ary = ary , dtype = self . _tensor . dtype , base = self )