code: def mask_weight(weight):
      weights = tf.clip_by_norm(weight, 1)
      L = neighbour_matrix.T
      mask = tf.constant(L)
      input_size, output_size = weights.get_shape()
      input_size, output_size = int(input_size), int(output_size)
      assert (
          input_size % IN_JOINTS == 0 and output_size % IN_JOINTS == 0
      )
      in_F = int(input_size / IN_JOINTS)
      out_F = int(output_size / IN_JOINTS)
      weights = tf.reshape(weights, [IN_JOINTS, in_F, IN_JOINTS, out_F])
      mask = tf.reshape(mask, [IN_JOINTS, 1, IN_JOINTS, 1])
  
      weights = tf.cast(weights, dtype=tf.float32)
      mask = tf.cast(mask, dtype=tf.float32)
  
      masked_weights = weights * mask
      masked_weights = tf.reshape(
          masked_weights, [input_size, output_size]
      )
      return masked_weights
  
file_path: TensorLayer/tensorlayer/app/human_pose_estimation/common.py
imports: import tensorflow
  import numpy
  import pickle
  import matplotlib.pyplot
  import os
  import matplotlib.gridspec
label_desc: Use image node_id 1 for calling a global function with example usage: mask_weight(weight) and returns: masked_weights