code: def PersonalizedAttentivePooling(dim1, dim2, dim3, seed=0):
      """Soft alignment attention implement.
  
      Attributes:
          dim1 (int): first dimention of value shape.
          dim2 (int): second dimention of value shape.
          dim3 (int): shape of query
  
      Returns:
          object: weighted summary of inputs value.
      """
      vecs_input = keras.Input(shape=(dim1, dim2), dtype="float32")
      query_input = keras.Input(shape=(dim3,), dtype="float32")
  
      user_vecs = layers.Dropout(0.2)(vecs_input)
      user_att = layers.Dense(
          dim3,
          activation="tanh",
          kernel_initializer=keras.initializers.glorot_uniform(
              seed=seed
          ),
          bias_initializer=keras.initializers.Zeros(),
      )(user_vecs)
      user_att2 = layers.Dot(axes=-1)([query_input, user_att])
      user_att2 = layers.Activation("softmax")(user_att2)
      user_vec = layers.Dot((1, 1))([user_vecs, user_att2])
  
      model = keras.Model([vecs_input, query_input], user_vec)
      return model
  
imports: import tensorflow.compat.v1.keras
  from tensorflow.compat.v1.linalg import einsum
  from tensorflow.compat.v1.keras import layers
  from tensorflow.compat.v1.keras import backend
label_desc: Use image node_id 1 for calling a global function with example usage: PersonalizedAttentivePooling(dim1, dim2, dim3, seed) and returns: model