iKintosh / GaborNet

https://ikintosh.github.io/GaborNet/
MIT License
102 stars 26 forks source link

Make weights fixed in eval mode #2

Closed iKintosh closed 4 years ago

iKintosh commented 5 years ago

Is there any way to make GaborLayer not to calculate weights every time in evaluate or no_grads mode?

I guess I should change something in forward method, but I have no idea what to do.

https://github.com/iKintosh/GaborNet/blob/435e031790086110bb61ffb6b8f18cfb0b3d39b8/GaborLayers.py#L71-L93

h-sh-h commented 5 years ago

Hi Can't you use self.training in the forward method? Actually, I tried it in your code and it returns True when the model is in train mode (model.train()) and False when the model is in eval mode (model.eval())

happyday521 commented 3 years ago

@h-sh-h Hi, can you explain to me why the following code can make weights fixed in the eval mode? What is the function of the parameter self.is_calculated? Thanks very much! image