Thanks for the code!
Your pooling layer is created using return_indices=True, i.e. the result will be a tuple containing the pooled activation map and the indices.
I’m not sure where and how you would like to use the indices, but this should fix the error:
...
pool1, idx1 = self.pool(rect1)
conv2a = self.conv2a(pool1)
...