shlogg · Early preview
Super Kai (Kazuya Ito) @superkai_kazuya

Subtracting Tensors With Torch: A Comprehensive Guide

sub() can perform subtraction with tensors or scalars, returning a 0D or more D tensor of zero or more elements. It supports torch and tensors as input, with optional alpha parameter for element-wise multiplication.

Buy Me a Coffee☕
*Memos:

My post explains add().
My post explains mul().
My post explains div().
My post explains remainder().
My post explains fmod().

sub() can do subtraction with two of the 0D or more D tensors of zero or more elements or scalars or the 0D or more D tensor of zero or more elements and a scalar, getting the 0D or more D tensor of zero or more elements as shown below:
*Memos:

sub() can be used with torch or a tensor.
The 1st argument(input) with torch(Type:tensor or scalar of int, float or complex) or using a tensor(Type:tensor of int, float or complex)(Required).
The 2nd...