...

/

Element-wise Mathematical Operations on Tensors

Element-wise Mathematical Operations on Tensors

In this lesson, we will discuss element-wise mathematical operations between tensors and scalar values.

Math operation with scalar

If you have used the NumPy array before, you may already know that we can perform a math operation between a NumPy array and a scalar. PyTorch tensor supports almost the same operations. In PyTorch, we perform it in two ways:

  • The operators, such as +, -, and *
...