TUTORIALAI & dataFETCHED
PyTorch torch.logspace 函数
PyTorch torch.logspace 函数 Pytorch torch 参考手册 torch.logspace 是 PyTorch 中用于创建对数间隔序列张量的函数。 函数定义 torch.logspace(start, end, steps, base, dtype, device, requires_grad) 使用示例 实例 [mycode4 type='python'] impor..
Updated 7/16/2026
Tutorial detail pages default to noindex.
PyTorch torch.logspace 函数
torch.logspace 是 PyTorch 中用于创建对数间隔序列张量的函数。
函数定义
torch.logspace(start, end, steps, base, dtype, device, requires_grad)
使用示例
实例
import torch
# 创建以 10 为底的对数间隔序列
x = torch.logspace(0, 1, 5)
print(x)
# 创建以 10 为底的对数间隔序列
x = torch.logspace(0, 1, 5)
print(x)
输出结果为:
tensor([ 1.0000, 1.7783, 3.1623, 5.6234, 10.0000])
Pytorch torch 参考手册