code: def get_weights(self, train_set, batch_size=64):
      X = np.zeros((self.n_users, self.n_factors))
      Y = np.zeros((self.n_items, self.n_factors))
      for batch_users in train_set.user_iter(batch_size):
          (
              i_user_review,
              i_user_iid_review,
              i_user_num_reviews,
          ) = get_data(
              batch_users,
              train_set,
              self.max_text_length,
              by="user",
              max_num_review=self.max_num_review,
          )
          user_review_embedding = self.graph.l_user_review_embedding(
              i_user_review
          )
          user_review_h = self.graph.user_text_processor(
              user_review_embedding, training=False
          )
          a_user = self.graph.a_user(
              tf.concat(
                  [
                      user_review_h,
                      self.graph.l_user_iid_embedding(
                          i_user_iid_review
                      ),
                  ],
                  axis=-1,
              )
          )
          a_user_masking = tf.expand_dims(
              tf.sequence_mask(
                  tf.reshape(i_user_num_reviews, [-1]),
                  maxlen=i_user_review.shape[1],
              ),
              -1,
          )
          user_attention = self.graph.user_attention(
              a_user, a_user_masking
          )
          user_Oi = tf.reduce_sum(
              tf.multiply(user_attention, user_review_h), 1
          )
          Xu = self.graph.Xu(user_Oi)
          X[batch_users] = Xu.numpy()
      for batch_items in train_set.item_iter(batch_size):
          (
              i_item_review,
              i_item_uid_review,
              i_item_num_reviews,
          ) = get_data(
              batch_items,
              train_set,
              self.max_text_length,
              by="item",
              max_num_review=self.max_num_review,
          )
          item_review_embedding = self.graph.l_item_review_embedding(
              i_item_review
          )
          item_review_h = self.graph.item_text_processor(
              item_review_embedding, training=False
          )
          a_item = self.graph.a_item(
              tf.concat(
                  [
                      item_review_h,
                      self.graph.l_item_uid_embedding(
                          i_item_uid_review
                      ),
                  ],
                  axis=-1,
              )
          )
          a_item_masking = tf.expand_dims(
              tf.sequence_mask(
                  tf.reshape(i_item_num_reviews, [-1]),
                  maxlen=i_item_review.shape[1],
              ),
              -1,
          )
          item_attention = self.graph.item_attention(
              a_item, a_item_masking
          )
          item_Oi = tf.reduce_sum(
              tf.multiply(item_attention, item_review_h), 1
          )
          Yi = self.graph.Yi(item_Oi)
          Y[batch_items] = Yi.numpy()
      W1 = self.graph.W1.get_weights()[0]
      user_embedding = self.graph.l_user_embedding.get_weights()[0]
      item_embedding = self.graph.l_item_embedding.get_weights()[0]
      bu = self.graph.user_bias.get_weights()[0]
      bi = self.graph.item_bias.get_weights()[0]
      mu = self.graph.add_global_bias.get_weights()[0][0]
      return X, Y, W1, user_embedding, item_embedding, bu, bi, mu
  
imports: import numpy
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import layers, initializers, Input
  from tensorflow.python.keras.preprocessing.sequence import pad_sequences
  from ...utils import get_rng
  from ...utils.init_utils import uniform
label_desc: Use image node_id 2 for calling the NARREModel obj's underlying member method code with example usage: obj.get_weights(train_set, batch_size) and returns: X,  Y,  W1,  user_embedding,  item_embedding,  bu,  bi,  mu