Issue with 07_batchnorm.ipynb

Hi m using google colab

I am getting the error in below procedure at the line with comments below
x.var is not taking dim as tuple.
Is any one getting the same error

    def update_stats(self, x):
            print(x.size())
            m = x.mean((0,2,3), keepdim=True)
            print(m.size())
            v = x.var((0,2,3), keepdim=True) # This gives syntax error saying Var() needs dim as int but tuple given
            self.means.lerp_(m, self.mom)
            self.vars.lerp_ (v, self.mom)
            return m,v
1 Like

Yes. I just saw Sylvain’s response in the Lesson 10 Discussion Thread:

I ran this command:
conda install -c pytorch pytorch-nightly

It’s working for me now.

With 1.1 out, just updating PyTorch should be enough now.

Oh, that’s strange. I assumed my pytorch was up-to-date because I ran conda update --all first, but this is what I get:

## Package Plan ##

environment location: /opt/anaconda3

The following packages will be UPDATED:
pytorch            pytorch::pytorch-1.0.0-py3.7_cuda10.0~ --> pkgs/main::pytorch-1.0.1-cuda100py37he554f03_0

EDIT: I’ve read Jeremy’s first post of https://forums.fast.ai/t/lesson-10-discussion-wiki-2019/42781 where he explains why this is. If anyone is still confused, please refer to that.