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