code: def local_abstract_batch_norm_train_grad(node):
      if not isinstance(node.op, AbstractBatchNormTrainGrad):
          return None
  
      x, dy, scale, x_mean, x_invstd, epsilon = node.inputs
      axes = node.op.axes
      if min(axes) < 0 or max(axes) > x.ndim:
          return None
      if (
          not isinstance(x.type, TensorType)
          or not isinstance(dy.type, TensorType)
          or not isinstance(scale.type, TensorType)
          or not isinstance(x_mean.type, TensorType)
          or not isinstance(x_invstd.type, TensorType)
          or not isinstance(epsilon.type, TensorType)
      ):
          return None
  
      x_diff = x - x_mean
      mean_dy_x_diff = T.mean(dy * x_diff, axis=axes, keepdims=True)
      c = (dy * x_invstd) - x_diff * (mean_dy_x_diff * (x_invstd**3))
  
      g_wrt_inputs = scale * (c - T.mean(c, axis=axes, keepdims=True))
      g_wrt_scale = T.sum(
          dy * x_invstd * x_diff, axis=axes, keepdims=True
      )
      g_wrt_bias = T.sum(dy, axis=axes, keepdims=True)
      results = [g_wrt_inputs, g_wrt_scale, g_wrt_bias]
  
      results = [
          T.patternbroadcast(r, r_orig.broadcastable)
          for (r, r_orig) in zip(results, node.outputs)
      ]
  
      for var in theano.gof.graph.variables(node.inputs, results):
          if var not in node.inputs:
              copy_stack_trace(node.outputs[0], var)
      return results
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import theano
  from theano import Apply, Op
  from theano.gof import local_optimizer
  from theano.gof.opt import copy_stack_trace
  from theano.tensor import as_tensor_variable, TensorType
  from theano.tensor import basic
  from theano.tensor.opt import register_specialize_device
  from theano.scalar import Composite, as_common_dtype
  from theano.scalar import add, sub, true_div, mul
label_desc: Use image node_id 6 for calling a global function with example usage: local_abstract_batch_norm_train_grad(node) and returns: results, None, None, None