code: def forward(self, hidden_states):
      attention_weights = []
      for layer_block in self.layer:
          hidden_states, weights = layer_block(hidden_states)
          if self.vis:
              attention_weights.append(weights)
      encoded = self.encoder_norm(hidden_states)
      return encoded, attention_weights
  
imports: import copy
  import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from medicalseg.cvlibs import manager
  from medicalseg.utils import load_pretrained_model
label_desc: Use image node_id 2 for calling the Encoder obj's underlying member method code with example usage: obj.forward(hidden_states) and returns: encoded,  attention_weights