PyTorch torch.logspace Function


Pytorch torch 参考手册Pytorch torch Reference Manual

torch.logspaceIt is a function in PyTorch used to create a logarithmically spaced sequence tensor.

Function Definition

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

Usage Examples

Example

import torch

# Create a base-10 logarithmically spaced sequence
x = torch.logspace(0, 1, 5)

print(x)

The output result is:

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

Pytorch torch 参考手册Pytorch torch Reference Manual

Other Extensions