Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.logspace function

PyTorch torch.logspace function


PyTorch torch reference manual PyTorch torch reference manual

torch.logspace is a function in PyTorch used to create a tensor with logarithmically spaced values.

Function definition

torch.logspace(start, end, steps, base, dtype, device, requires_grad)


Usage examples

Example

import

torch

Create a logarithmically spaced sequence with base 10

x

=

torch.

logspace

(

0

,

1

,

5

)

print

(

x

)

The output is:

tensor([ 1.0000,  1.7783,  3.1623,  5.6234, 10.0000])


PyTorch torch reference manual PyTorch torch reference manual