torch.Tensor.sparse_dim¶ Tensor.sparse_dim() → int¶ 返回稀疏張量 sparse tensor self 中的稀疏維度數量。 注意 如果 self 不是稀疏張量,則返回 0。 另請參閱 Tensor.dense_dim() 和 混合張量。