torch.Tensor.sparse_resize_¶
- Tensor.sparse_resize_(size, sparse_dim, dense_dim) Tensor ¶
Resizes
self
sparse tensor to the desired size and the number of sparse and dense dimensions.Note
If the number of specified elements in
self
is zero, thensize
,sparse_dim
, anddense_dim
can be any size and positive integers such thatlen(size) == sparse_dim + dense_dim
.If
self
specifies one or more elements, however, then each dimension insize
must not be smaller than the corresponding dimension ofself
,sparse_dim
must equal the number of sparse dimensions inself
, anddense_dim
must equal the number of dense dimensions inself
.Warning
Throws an error if
self
is not a sparse tensor.