torch.Tensor.sparse_dim¶ Tensor.sparse_dim() → int¶ 返回稀疏张量 self 中的稀疏维度数量。 注意 如果 self 不是稀疏张量,则返回 0 。 参见 Tensor.dense_dim() 和混合张量。