tfjgeorge / nngeometry

{KFAC,EKFAC,Diagonal,Implicit} Fisher Matrices and finite width NTKs in PyTorch

Home Page:https://nngeometry.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compute KFAC matrix on big network

fmaaf opened this issue · comments

commented

hi, have you tried to compute the KFAC matrix on a little big networks such as resnet18? I tried to replace the network by resnet18 in your examples Continual_learning_EWC.ipynb , however it seems that the KFAC matrix is too big to be computed.
this is the error:
File "/nngeometry/nngeometry/metrics.py", line 171, in FIM
return representation(generator=generator, examples=loader)
File "/nngeometry_/nngeometry/object/pspace.py", line 439, in init
self.data = generator.get_kfac_blocks(examples)
File "/nngeometry_/nngeometry/generator/jacobian/init.py", line 247, in get_kfac_blocks
output = self.function(*d).view(bs, self.n_output).sum(dim=0)
RuntimeError: shape '[50, 30]' is invalid for input of size 50000_

commented

ok, I will send by email.

It looks like you are using a 1000-fold output layer but you task requires only 30 classes.