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

Understanding PyTorch's Prod() And Cartesian_prod() Functions

Learn how to use `prod()` and `cartesian_prod()` in PyTorch for tensor operations. Get product of elements or cartesian products with examples.

Buy Me a Coffee☕
*Memos:

My post explains sum() and nansum().
My post explains mean() and nanmean().
My post explains median() and nanmedian().
My post explains cumsum() and cumprod().

prod() can get the 0D or more D tensor of zero or more product's elements from the 0D or more D tensor of zero or more elements as shown below:
*Memos:

prod() can be used with torch or a tensor.
The 1st argument(input) with torch or using a tensor(Required-Type:tensor of int, float, complex or bool).
The 2nd argument with torch or the 1st argument with a tensor is dim(Optional-Type:int).
The 3rd argument wit...