code: def _calc_axis_and_m(x_shape, batch_size):
      m = batch_size
      spatial_ndim = len(x_shape) - 2
      spatial_axis = tuple(range(2, 2 + spatial_ndim))
      for i in spatial_axis:
          m *= x_shape[i]
      return spatial_axis, m
  
imports: import numpy
  from chainer import backend
  from chainer import function_node
  from chainer.utils import argument
  from chainer.utils import type_check
label_desc: Use image node_id 4 for calling a global function with example usage: _calc_axis_and_m(x_shape, batch_size) and returns: spatial_axis,  m