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

Mastering Torch.arange() For Efficient Tensor Generation

arange() creates a 1D tensor of zero or integers or floating-point numbers between start and end-1. With torch, it has optional arguments: start, end, step, dtype, device, requires_grad, and out.

Buy Me a Coffee☕
*Memos:

My post explains linspace().
My post explains logspace().

arange() can create the 1D tensor of zero or integers or floating-point numbers between start and end-1(start<=x<=end-1) as shown below:
*Memos:

arange() can be used with torch but not with a tensor.
The 1st argument with torch is start(Optional-Default:0-Type:int, float, complex or bool):
*Memos

It must be lower than or equal to end. 
The 0D tensor of int, float, complex or bool also works.


The 2nd argument with torch is end(Required-Type:int, float, complex or bool):
*Memos:

It must be greater than or...