Has no attribute 'Transformer'

I tried to add a layer ‘Transformer’, but got an error:
module ‘torch.nn’ has no attribute ‘Transformer’

how can i fix this?

I’m not too sure that pytorch version >= 1.2.0 (nightly now) includes Transformer modules.

It should do https://github.com/pytorch/pytorch/releases/tag/v1.2.0

Which version are you running?

1 Like