code: def get_weights(self, train_set, batch_size=64):
      P = np.zeros(
          (
              self.n_users,
              self.n_filters + self.n_factors + self.id_embedding_size,
          )
      )
      Q = np.zeros(
          (
              self.n_items,
              self.n_filters + self.n_factors + self.id_embedding_size,
          )
      )
      A = np.zeros((self.n_items, self.max_num_review))
      for batch_users in train_set.user_iter(batch_size, shuffle=False):
          i_user_review, i_user_num_reviews, i_user_rating = 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
          )
          user_rating_h = self.graph.l_user_mlp(i_user_rating)
          a_user = self.graph.a_user(
              tf.multiply(
                  user_review_h, tf.expand_dims(user_rating_h, 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
          )
          ou = self.graph.ou(
              tf.reduce_sum(
                  tf.multiply(user_attention, user_review_h), 1
              )
          )
          pu = tf.concat(
              [
                  user_rating_h,
                  ou,
                  self.graph.l_user_embedding(batch_users),
              ],
              axis=-1,
          )
          P[batch_users] = pu.numpy()
      for batch_items in train_set.item_iter(batch_size, shuffle=False):
          i_item_review, i_item_num_reviews, i_item_rating = 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
          )
          item_rating_h = self.graph.l_item_mlp(i_item_rating)
          a_item = self.graph.a_item(
              tf.multiply(
                  item_review_h, tf.expand_dims(item_rating_h, 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
          )
          oi = self.graph.oi(
              tf.reduce_sum(
                  tf.multiply(item_attention, item_review_h), 1
              )
          )
          qi = tf.concat(
              [
                  item_rating_h,
                  oi,
                  self.graph.l_item_embedding(batch_items),
              ],
              axis=-1,
          )
          Q[batch_items] = qi.numpy()
          A[
              batch_items, : item_attention.shape[1]
          ] = item_attention.numpy().reshape(item_attention.shape[:2])
      W1 = self.graph.W1.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 P, Q, W1, bu, bi, mu, A
  
file_path: cornac/cornac/models/hrdr/hrdr.py
imports: import numpy
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import layers, initializers
  from tensorflow.python.keras.preprocessing.sequence import pad_sequences
  from ...utils import get_rng
  from ...utils.init_utils import uniform
  from ..narre.narre import TextProcessor, AddGlobalBias
label_desc: Use image node_id 2 for calling the HRDRModel obj's underlying member method code with example usage: obj.get_weights(train_set, batch_size) and returns: P,  Q,  W1,  bu,  bi,  mu,  A