MCPcopy Create free account
hub / github.com/PyGCL/PyGCL / drop_feature

Function drop_feature

GCL/augmentors/functional.py:89–96  ·  view source on GitHub ↗
(x: torch.Tensor, drop_prob: float)

Source from the content-addressed store, hash-verified

87
88
89def drop_feature(x: torch.Tensor, drop_prob: float) -> torch.Tensor:
90 device = x.device
91 drop_mask = torch.empty((x.size(1),), dtype=torch.float32).uniform_(0, 1) < drop_prob
92 drop_mask = drop_mask.to(device)
93 x = x.clone()
94 x[:, drop_mask] = 0
95
96 return x
97
98
99def dropout_feature(x: torch.FloatTensor, drop_prob: float) -> torch.FloatTensor:

Callers 3

augmentMethod · 0.90
augmentMethod · 0.90
__call__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected