AttributeError: 'Test' object has no attribute 'maxpool'

Hi,

I’m new to PyTorch, and while running the example code available at this link:

I encountered the following error:
./venv9/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1614, in getattr
raise AttributeError(“‘{}’ object has no attribute ‘{}’”.format(
AttributeError: ‘Test’ object has no attribute ‘maxpool’

Here is my local environment information:
OS: ubuntu 22.04
Python: 3.9.18
torch: 2.0.1+cu118

I’m unsure why I’m getting this error, if someone can provide me with any hints or guidance, it would be much appreciated.

Thanks,
Sam

Could you post a minimal and executable code snippet here as I cannot reach the pastebin snippet?

Make sure the __init__ method for your Test class is spelled correctly, and also when you call the superclass constructor.

Replacing both __int__ with __init__ should work.

Thank you all so much! I just realized the typo; after replacing __int__ with __init__, it now works perfectly.