code: def din_fcn_shine(
      query,
      facts,
      attention_size,
      mask,
      stag="null",
      mode="SUM",
      softmax_stag=1,
      time_major=False,
      return_alphas=False,
  ):
      if isinstance(facts, tuple):
          # In case of Bi-RNN, concatenate the forward and the backward RNN outputs.
          facts = tf.concat(facts, 2)
  
      if time_major:
          # (T,B,D) => (B,T,D)
          facts = tf.array_ops.transpose(facts, [1, 0, 2])
      # Trainable parameters
      mask = tf.equal(mask, tf.ones_like(mask))
      facts_size = facts.get_shape().as_list()[
          -1
      ]  # D value - hidden size of the RNN layer
      querry_size = query.get_shape().as_list()[-1]
      query = tf.compat.v1.layers.dense(
          query,
          facts_size,
          activation=None,
          name="f1_trans_shine" + stag,
      )
      query = prelu(query)
      queries = tf.tile(query, [1, tf.shape(facts)[1]])
      queries = tf.reshape(queries, tf.shape(facts))
      din_all = tf.concat(
          [queries, facts, queries - facts, queries * facts], axis=-1
      )
      d_layer_1_all = tf.compat.v1.layers.dense(
          din_all,
          facts_size,
          activation=tf.nn.sigmoid,
          name="f1_shine_att" + stag,
      )
      d_layer_2_all = tf.compat.v1.layers.dense(
          d_layer_1_all,
          facts_size,
          activation=tf.nn.sigmoid,
          name="f2_shine_att" + stag,
      )
      d_layer_2_all = tf.reshape(d_layer_2_all, tf.shape(facts))
      output = d_layer_2_all
      return output
  
imports: import tensorflow
  from tensorflow.python.ops.rnn_cell import *
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import init_ops
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.util import nest
  from tensorflow.python.ops import nn_ops
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 8 for calling a global function with example usage: din_fcn_shine(query, facts, attention_size, mask, stag, mode, softmax_stag, time_major, return_alphas) and returns: output