MCPcopy Create free account
hub / github.com/pytorch/tutorials / __init__

Method __init__

intermediate_source/parametrizations.py:335–339  ·  view source on GitHub ↗
(self, X, p_drop=0.2)

Source from the content-addressed store, hash-verified

333# of a randomized pruning method:
334class PruningParametrization(nn.Module):
335 def __init__(self, X, p_drop=0.2):
336 super().__init__()
337 # sample zeros with probability p_drop
338 mask = torch.full_like(X, 1.0 - p_drop)
339 self.mask = torch.bernoulli(mask)
340
341 def forward(self, X):
342 return X * self.mask

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected