torch.Tensor.sparse_resize_#
- Tensor.sparse_resize_(size, sparse_dim, dense_dim) Tensor#
Resizes
selfsparse tensor to the desired size and the number of sparse and dense dimensions.Note
If the number of specified elements in
selfis zero, thensize,sparse_dim, anddense_dimcan be any size and positive integers such thatlen(size) == sparse_dim + dense_dim.If
selfspecifies one or more elements, however, then each dimension insizemust not be smaller than the corresponding dimension ofself,sparse_dimmust equal the number of sparse dimensions inself, anddense_dimmust equal the number of dense dimensions inself.Warning
Throws an error if
selfis not a sparse tensor.- Parameters
size (torch.Size) – the desired size. If
selfis non-empty sparse tensor, the desired size cannot be smaller than the original size.sparse_dim (int) – the number of sparse dimensions
dense_dim (int) – the number of dense dimensions