Integer division with addcdiv is deprecated, and in a future release
addcdiv will perform a true division of tensor1
and tensor2
.
The current addcdiv behavior can be replicated using torch_floor_divide()
for integral inputs
(input
+ value
* tensor1
// tensor2
)
and torch_div()
for float inputs
(input
+ value
* tensor1
/ tensor2
).
The new addcdiv behavior can be implemented with torch_true_divide()
(input
+ value
* torch.true_divide(tensor1
,
tensor2
).
$$
\mbox{out}_i = \mbox{input}_i + \mbox{value} \times \frac{\mbox{tensor1}_i}{\mbox{tensor2}_i}
$$
The shapes of input
, tensor1
, and tensor2
must be
broadcastable .
For inputs of type FloatTensor
or DoubleTensor
, value
must be
a real number, otherwise an integer.