code: def loss_function(expected, predicted):
      epsilon = 1e-7  # for 32-bit float
  
      predicted = tf.clip_by_value(predicted, epsilon, 1.0 - epsilon)
      expected = tf.cast(tf_utils.flatten(expected), tf.int32)
  
      log_predicted = tf.log(predicted)
      indices = tf.stack(
          [tf.range(tf.size(expected)), expected], axis=1
      )
      errors = tf.gather_nd(log_predicted, indices)
  
      return -tf.reduce_mean(errors)
  
imports: import os
  import argparse
  from functools import partial
  import tensorflow
  from neupy import init, algorithms, storage
  from neupy.layers import *
  from neupy.utils import as_tuple, asfloat, tf_utils, tensorflow_session
  from loaddata import load_data
  from settings import MODELS_DIR, environments
  from evaluation import evaluate_accuracy
label_desc: Use image node_id 3 for calling a global function with example usage: loss_function(expected, predicted) and returns: unknown