mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-06-24 02:14:17 +00:00
simpler batchnorm
This commit is contained in:
parent
30025f2bc7
commit
ebd7290f56
1 changed files with 1 additions and 1 deletions
|
|
@ -30,7 +30,7 @@ class BatchNorm2D:
|
|||
|
||||
def normalize(self, x, mean, var):
|
||||
x = (x - mean.reshape(shape=[1, -1, 1, 1])) * self.weight.reshape(shape=[1, -1, 1, 1])
|
||||
return x.div(var.add(self.eps).reshape(shape=[1, -1, 1, 1])**0.5) + self.bias.reshape(shape=[1, -1, 1, 1])
|
||||
return x.mul(var.add(self.eps).reshape(shape=[1, -1, 1, 1])**-0.5) + self.bias.reshape(shape=[1, -1, 1, 1])
|
||||
|
||||
class Conv2d:
|
||||
def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, bias=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue