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

Understanding PyTorch's Expand() Function For Tensors

expand() in PyTorch: Expand a tensor to the specified size. Can be used with tensors of different data types (int, float, complex, bool). Example usage: `my_tensor.expand((4, 2, 3))

Buy Me a Coffee☕
*Memos:

My post explains tile().
My post explains repeat().
My post explains repeat_interleave().

expand() can get the 0D or more D view tensor of zero or more expanded elements from the 0D or more D tensor of zero or more elements as shown below:
*Memos:

expand() can be used with a tensor but not with torch.
Using a tensor(Required-Type:tensor of int, float, complex or bool). 
The 1st or more arguments with a tensor are size(Required-Type:int, tuple of int, list of int or size()):
*Memos:

Its D must be more than or equal to the tensor's D
If at least one dimension is 0,...