Syntax Error when calling the name of a model's layer in captum
I'm trying to use the gradCAM feature of captum for PyTorch. Previously, I asked the question of how to find the name of layers in pyTorch (which is done using model.named_modules()). However, since getting the names of the modules (my model name is 'model') I have tried to use it with LayerGradCam from captum and am receiving a syntax error - it seems to always happen on the 'number' within the model name.
I import the function with:
from captum.attr import LayerGradCam

I'm a bit of a Python newbie, so I've tried calling both:
layer_gc = LayerGradCam(segmentation_wrapper, model.dl.backbone.layer4.2.conv3)

and:
layer_gc = captum.attr.LayerGradCam(segmentation_wrapper, model.dl.backbone.layer4.2.conv3)

The error message I get is:
  File &quot;gradCAM.py&quot;, line 120
    layer_gc = LayerGradCam(segmentation_wrapper, model.dl.backbone.layer4.2.conv3)
                                                                           ^
SyntaxError: invalid syntax

This is really stumping me, so any help is appreciated! Thanks in advance :)

Array or list indexing is done using [] syntax, not ..
model.dl.backbone.layer4[2]conv3

