QAT: AttributeError: 'Sequential' object has no attribute 'Conv2d'

Hi,

I am performing QAT and encounter the error:
AttributeError: 'Sequential' object has no attribute 'Conv2d'
When running the line:
torch.quantization.fuse_modules(basic_block, [["Conv2d", "BatchNorm2d", "ReLU"]], inplace=True)

where the basic_block is:

Sequential(
  (0): Conv2d(512, 256, kernel_size=(1, 1), stride=(1, 1))
  (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
  (2): ReLU()
  (3): Sequential(
    (0): Conv2d(256, 256, kernel_size=(3, 3), stride=(2, 2), padding=(2, 2), groups=256)
    (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (2): ReLU()
    (3): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1))
  )
)

Any suggestion what should I modify to correct the error?

Thanks a lot.

change
torch.quantization.fuse_modules(basic_block, [["Conv2d", "BatchNorm2d", "ReLU"]], inplace=True)

to
torch.quantization.fuse_modules(basic_block, [["0", "1", "2"]], inplace=True)

Then it works.