I tried to save the output feature maps in the “forward” function.
the function is
 def forward(self, x):
        x = self.forward_features(x)
        x = self.head(x)
        return x
what i tried is
 y=x[-1].cpu().numpy()
        with open('res.pkl', 'wb') as df_file:
             pickle.dump(y, file = df_file)
but got tensor for one image , how can i got for all images?
Does what i made right ?
Tensor like that
tensor([[0.8981, 0.4641, 0.5740,  ..., 0.4593, 0.0317, 0.2112],
        [0.2477, 0.8282, 0.1286,  ..., 0.9769, 0.5973, 0.4928],
        [0.1353, 0.3044, 0.8599,  ..., 0.9786, 0.2175, 0.0837],
        ...,
        [0.1227, 0.1812, 0.0287,  ..., 0.3544, 0.9123, 0.4494],
        [0.9301, 0.2900, 0.1742,  ..., 0.0343, 0.6522, 0.9424],
        [0.4368, 0.0536, 0.2494,  ..., 0.5699, 0.3439, 0.6585]])
 
    