Function torch::nn::init::sparse_
Defined in File init.h
Function Documentation
-
Tensor torch::nn::init::sparse_(Tensor tensor, double sparsity, double std = 0.01)
Fills the 2D input
Tensor
as a sparse matrix, where the non-zero elements will be drawn from a centered normal distribution with the given standard deviationstd
, as described in “Deep learning via
Hessian-free optimization” - Martens, J.
(2010). The
sparsity
is a real value between 0 and 1 that controls the fraction of elements in each column to be set to zero. No gradient will be recorded for this operation.