torch.Tensor.dense_dim

Tensor.dense_dim() int

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

注意

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

另见Tensor.sparse_dim()混合张量

本页目录