MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / to_dense

Method to_dense

deepspeed/runtime/sparse_tensor.py:42–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40 return "deepspeed.SparseTensor"
41
42 def to_dense(self):
43 it = self.indices.unsqueeze(1)
44 full_indices = torch.cat([it for _ in range(self.dense_size[1])], dim=1)
45 return self.values.new_zeros(self.dense_size).scatter_add_(0, full_indices, self.values)
46
47 def sparse_size(self):
48 index_size = list(self.indices.size())

Callers 4

test_csr_addition_selfFunction · 0.95
testMethod · 0.80

Calls

no outgoing calls

Tested by 3

test_csr_addition_selfFunction · 0.76
testMethod · 0.64