def reshape(tensor, shape, copy=True, name=None): """Change the dimensions of input. Examples: ```python # Provide a determined value for each dimension if possible x = tf.ones(shape=(1, 2, 3, 4)) print(tf.reshape(x, shape=[6, 4]).shape) # [6, 4] # Set the existing dimensions to ``0`` if it unchanged print(tf.reshape(x, shape=[0, 0, 12]).shape) # [1, 2, 12] print(tf.reshape(x, shape=[0, 0, 0, 0]).shape) # [1, 2, 3, 4] print(tf.reshape(x, shape=[0, 0, 0, 0, 0]).shape) # Wrong # You can also set ``-1`` once to infer the value print(tf.reshape(x, shape=[-1, 4]).shape) # [6, 4] print(tf.reshape(x, shape=[-1, -1]).shape) # Wrong ``` Parameters ---------- tensor : dragon.Tensor The input tensor. shape : Union[Sequence[int], dragon.Tensor] The output shape. copy : bool, optional, default=True Return a new tensor or call in-place. name : str, optional The operation name. """ return array_ops.reshape(tensor, shape=shape, copy=copy, name=name)
def reshape(self, shape): """Return a tensor containing the same data with new shape. Parameters ---------- shape : Sequence[int] The new shape. Returns ------- dragon.EagerTensor The output tensor. See Also -------- `dragon.reshape(...)`_ """ with context.eager_mode(): return array_ops.reshape(self, shape=shape)
def reshape(self, shape, copy=True): """Return a tensor containing the same data with new shape. Parameters ---------- shape : Union[Sequence[int], dragon.Tensor] The output shape. copy : bool, optional, default=True Return a new tensor or reshape in-place. Returns ------- dragon.Tensor The output tensor. See Also -------- `dragon.reshape(...)`_ """ return array_ops.reshape(self, shape=shape, copy=copy)
def forward(self, inputs, **kwargs): return array_ops.reshape(inputs, shape=self.shape)
def call(self, inputs): return array_ops.reshape(inputs, shape=[0] + self.target_shape)
def __call__(self, bottom): return array_ops.reshape(bottom, **self.arguments)
def __call__(self, bottom): return array_ops.reshape(bottom, **self.call_args)