PyTorch torch.divide Function

PyTorch torch.divide Function


Pytorch torch 参考手册PyTorch torch Reference Manual

torch.divideIt is a function in PyTorch for element-wise division (equivalent to div).

Function Definition

torch.divide(input, other, *, rounding_mode=None, out=None)

Usage Example

Example

import torch

# Element-wise division example
x = torch.tensor([10.0, 20.0, 30.0])
y = torch.tensor([2.0, 4.0, 5.0])
result = torch.divide(x, y)
print(result)  # tensor([5.0000, 5.0000, 6.0000])

Pytorch torch 参考手册PyTorch torch Reference Manual

Other Extensions