Solved by aulakh83 in post #2 
              
              
                I got the solution by writing it as 
parameters_to_prune = ( 
(encoderCNN.cnn[0][0],‘weight’), 
(encoderCNN.cnn[0][2], ‘weight’), 
)