linspace¶
- dragon.vm.torch.- linspace(
 start,
 end,
 steps=100,
 out=None,
 dtype='int64',
 dim=0,
 device=None,
 requires_grad=False
 )[source]¶
- Generate evenly spaced values within intervals along the given dimension. - Interval \([\text{start}, \text{end})\) is determined for - stepsvalues:- x = torch.linspace(2, 4, steps=3) # [2, 3, 4] - More intervals are accepted to generate N-d coordinates: - x = torch.linspace([1, 2], [3, 4], steps=3, dim=0) # [[1, 2], [2, 3], [3, 4]] y = torch.linspace([1, 2], [3, 4], steps=3, dim=1) # [[1, 2, 3], [2, 3, 4]] - Parameters:
- start (Union[number, Sequence[number]]) – The start(s) of interval.
- end (Union[number, Sequence[number]]) – The ends(s) of interval.
- steps (int, optional, default=100) – The number of values to generate.
- out (dragon.vm.torch.Tensor, optional) – The output tensor.
- dtype (str, optional, default='int64') – The data type of output tensor.
- dim (int, optional, default=0) – The dimension to generate values.
- device (dragon.vm.torch.device, optional) – The device of output tensor.
- requires_grad (bool, optional, default=False) – Record gradient for output tensor or not.
 
 - Returns:
- dragon.vm.torch.Tensor – The output tensor. 
 
