Rate this Page

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, then size, sparse_dim, and dense_dim can be any size and positive integers such that len(size) == sparse_dim + dense_dim.

If self specifies one or more elements, however, then each dimension in size must not be smaller than the corresponding dimension of self, sparse_dim must equal the number of sparse dimensions in self, and dense_dim must equal the number of dense dimensions in self.

Warning

Throws an error if self is not a sparse tensor.

Parameters
  • size (torch.Size) – the desired size. If self is 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

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources
Morty Proxy This is a proxified and sanitized view of the page, visit original site.