MCPcopy Create free account
hub / github.com/DeepGraphLearning/S3F / Dropout

Class Dropout

s3f/gvp_layer.py:180–199  ·  view source on GitHub ↗

Combined dropout for tuples (s, V). Takes tuples (s, V) as input and as output.

Source from the content-addressed store, hash-verified

178
179
180class Dropout(nn.Module):
181 '''
182 Combined dropout for tuples (s, V).
183 Takes tuples (s, V) as input and as output.
184 '''
185 def __init__(self, drop_rate):
186 super().__init__()
187 self.sdropout = nn.Dropout(drop_rate)
188 self.vdropout = _VDropout(drop_rate)
189
190 def forward(self, x):
191 '''
192 :param x: tuple (s, V) of `torch.Tensor`,
193 or single `torch.Tensor`
194 (will be assumed to be scalar channels)
195 '''
196 if type(x) is torch.Tensor:
197 return self.sdropout(x)
198 s, v = x
199 return self.sdropout(s), self.vdropout(v)
200
201
202class GVPLayerNorm(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected