Defined in File init.h
sparse_(Tensor tensor, double sparsity, double std = 0.01)¶
Fills the 2D input
Tensoras a sparse matrix, where the non-zero elements will be drawn from a centered normal distribution with the given standard deviation
, as described in “Deep learning via
Hessian-free optimization” - Martens, J.
sparsityis 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.