评价此页

torch.Tensor.dense_dim#

Tensor.dense_dim() int#

返回稀疏张量self中密集维度的数量。

注意

如果self不是稀疏张量,则返回len(self.shape)

另请参阅 Tensor.sparse_dim()混合张量