oops, don't assign self

This commit is contained in:
George Hotz
2023-01-09 18:02:12 -08:00
parent fad7cba590
commit 90121482fa

View File

@@ -317,8 +317,8 @@ class Tensor:
return y.div((y*y).mean(axis=axis, keepdim=True).add(eps).sqrt())
def batchnorm(self, weight:Tensor, bias:Tensor, mean:Tensor, invstd:Tensor):
self = (self - mean.reshape(shape=[1, -1, 1, 1])) * weight.reshape(shape=[1, -1, 1, 1])
return self.mul(invstd.reshape(shape=[1, -1, 1, 1])) + bias.reshape(shape=[1, -1, 1, 1])
x = (self - mean.reshape(shape=[1, -1, 1, 1])) * weight.reshape(shape=[1, -1, 1, 1])
return x.mul(invstd.reshape(shape=[1, -1, 1, 1])) + bias.reshape(shape=[1, -1, 1, 1])
# An instantiation of the Function is the Context
class Function: