mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-18 02:21:40 -05:00
fix symbolic_ops tests with Tensor.training=True (#1686)
This commit is contained in:
@@ -670,7 +670,7 @@ class Tensor:
|
||||
return (ret + bias.reshape(shape=[1, -1, 1, 1])) if bias else ret
|
||||
|
||||
def dropout(self, p=0.5) -> Tensor:
|
||||
if not Tensor.training: return self
|
||||
if not Tensor.training or p == 0: return self
|
||||
mask = (Tensor.rand(*self.shape, requires_grad=False, device=self.device) >= p).cast(dtypes.bool)
|
||||
return self * mask * (1/(1.0 - p))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user