code: def test_ndarray_arithmetic_scalar_ops(seed, op, shape):
      rng = np.random.RandomState(seed)
      vx = nn.NdArray.from_numpy_array(
          rng.randn(*shape).astype(np.float32)
      )
      a = rng.randn()
      if op == "**" and vx.size > 0:
          vx.data += -vx.data.min() + 1.0
      vz = eval("vx {0} a".format(op))
      ref_z = eval("vx.data {0} a".format(op))
      assert_allclose(ref_z, vz.data)
  
      # Inplace test
      vx_bak = vx
      if op == "+":
          vx += a
      elif op == "-":
          vx -= a
      elif op == "*":
          vx *= a
      elif op == "/":
          vx /= a
      elif op == "**":
          vx **= a
      assert_allclose(vx.data, vz.data)
      if op == "**":
          # In-placing for `**` is obsoleted.
          return
      assert vx is vx_bak
  
file_path: nnabla/python/test/test_ndarray_arithmetic_ops.py
imports: from six import exec_
  import pytest
  import numpy
  import nnabla
  from nnabla.testing import assert_allclose
label_desc: Use image node_id 2 for calling a global function with example usage: test_ndarray_arithmetic_scalar_ops(seed, op, shape) without return types