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