简单使用:
import torch
# 创建一个二维张量
matrix_tensor = torch.tensor([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
# 获取第一行...first_row = matrix_tensor[0, :]
print("第一行:", first_row)
# 获取第一列
first_column = matrix_tensor[:, 0]...最大值
介绍: torch.max() 用于找到张量中的最大值及其索引。...指数运算
介绍: torch.exp() 用于计算张量元素的指数。...对数运算
介绍: torch.log() 用于计算张量元素的自然对数。