code: def restricted_softmax(inputs, dim=-1, margin=0):
      input_max = tf.reduce_max(inputs, axis=dim, keepdims=True)[0]
      input_max = tf.clip_by_value(
          input_max, clip_value_min=0, clip_value_max=tf.float32.max
      )
      out = tf.exp((inputs - input_max))
      out = out / (
          tf.reduce_sum(out, axis=dim, keepdims=True)
          + tf.exp(margin - input_max)
      )
      return out
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  import tf_euler
  from tf_euler.python.convolution import conv
  from tf_euler.python.euler_ops import mp_ops
label_desc: Use image node_id 1 for calling a global function with example usage: restricted_softmax(inputs, dim, margin) and returns: out