code: def ref_kl_multinomial(p, q, base_axis):
      base_axis = base_axis + p.ndim * (base_axis < 0)
  
      kl = np.sum(
          p * (np.log(p + 1.0e-8) - np.log(q + 1.0e-8)),
          axis=tuple(range(base_axis, p.ndim)),
      )
      return kl.reshape(kl.shape + (1,))
  
imports: import pytest
  import numpy
  import nnabla.functions
  from nbla_test_utils import list_context
label_desc: Use image node_id 1 for calling a global function with example usage: ref_kl_multinomial(p, q, base_axis) and returns: kl