code: def test_variable_arithmetic_scalar_ops(seed, op):
      rng = np.random.RandomState(seed)
      vx = nn.Variable.from_numpy_array(
          rng.randn(2, 3, 4).astype(np.float32)
      )
      a = rng.randn()
      if op == "**":
          vx.d += -vx.d.min() + 1.0
      with nn.auto_forward():
          vz = eval("vx {0} a".format(op))
          ref_z = eval("vx.d {0} a".format(op))
          assert_allclose(ref_z, vz.d)
  
      # Inplace test
      with nn.auto_forward():
          # Make function reference count of `vx` to 1.
          vx = nn.functions.identity(vx)
          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.d, vz.d)
          assert vx is not vx_bak
  
file_path: nnabla/python/test/test_variable_arithmetic_ops.py
imports: 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_variable_arithmetic_scalar_ops(seed, op) without return types