Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

nn_init_sparse_

Sparse initialization


Description

Fills the 2D input Tensor as a sparse matrix, where the non-zero elements will be drawn from the normal distribution as described in Deep learning via Hessian-free optimization - Martens, J. (2010).

Usage

nn_init_sparse_(tensor, sparsity, std = 0.01)

Arguments

tensor

an n-dimensional Tensor

sparsity

The fraction of elements in each column to be set to zero

std

the standard deviation of the normal distribution used to generate the non-zero values

Examples

if (torch_is_installed()) {
## Not run: 
w <- torch_empty(3, 5)
nn_init_sparse_(w, sparsity = 0.1)

## End(Not run)
}

torch

Tensors and Neural Networks with 'GPU' Acceleration

v0.3.0
MIT + file LICENSE
Authors
Daniel Falbel [aut, cre, cph], Javier Luraschi [aut], Dmitriy Selivanov [ctb], Athos Damiani [ctb], Christophe Regouby [ctb], Krzysztof Joachimiak [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.