Exponential of sparse tensor


is there a way to get the exp of a sparse tensor? It seems exp is not supported, and


where sparse is a sparse coalesced tensor.


RuntimeError: Could not run ‘aten::pow.Tensor_Tensor’ with arguments from the ‘SparseCPU’ backend. ‘aten::pow.Tensor_Tensor’ is only available for these backends: [CPU, CUDA, Named, Autograd, Profiler, Tracer, Autocast].

Since there is a Softmax implemented for sparse tensors I assume there is an exponential as well.
Thanks in advance for the help.


1 Like

Clumsy but working is to create the tensor manually using the values:

csp = sp.coalesce()
torch.sparse_coo_tensor(csp.indices(), csp.values().exp(), csp.shape)
1 Like