mindspore.Tensor.floor_divide_

Tensor.floor_divide_(other) Tensor[source]

Divides the self tensor by the other tensor element-wise and round down to the closest integer.

\[out_{i} = \text{floor}( \frac{self_i}{other_i})\]

where the \(floor\) indicates the Floor operator. For more details, please refer to the mindspore.mint.floor operator.

Warning

This is an experimental API that is subject to change or deletion.

Note

When self and other have different shapes, other should be able to broadcast to self.

Parameters

other (Union[Tensor, Number, bool]) – The other input is a number or a bool or a tensor whose data type is number or bool.

Returns

Tensor, the shape is the same as self , and the data type is the same as self .

Raises
  • TypeError – If other is not one of the following: Tensor, number.Number or bool.

  • RuntimeError – If other cannot be broadcast to self.

Supported Platforms:

Ascend

Examples

>>> import mindspore
>>> from mindspore import Tensor
>>> import numpy as np
>>> x = Tensor(np.array([2, 4, -1]), mindspore.int32)
>>> other = Tensor(np.array([3, 3, 3]), mindspore.int32)
>>> output = x.floor_divide_(other)
>>> print(output)
[ 0  1 -1]
>>> print(x)
[ 0  1 -1]