code: def test_ndarray_dot(seed, shape, is_dynamic):
      rng = np.random.RandomState(seed)
  
      if not shape[0]:
          a1 = rng.randn()
          n1 = nn.NdArray()
          n1.cast(np.float32)[...] = a1
          v1 = nn.Variable()
          v1.data.cast(np.float32)[...] = a1
      else:
          a1 = rng.randn(*shape[0]).astype(np.float32)
          n1 = nn.NdArray.from_numpy_array(a1)
          v1 = nn.Variable.from_numpy_array(a1)
  
      if not shape[1]:
          a2 = rng.randn()
          n2 = nn.NdArray()
          n2.cast(np.float32)[...] = a2
          v2 = nn.Variable()
          v2.data.cast(np.float32)[...] = a2
      else:
          a2 = rng.randn(*shape[1]).astype(np.float32)
          n2 = nn.NdArray.from_numpy_array(a2)
          v2 = nn.Variable.from_numpy_array(a2)
  
      ref = F.dot(a1, a2)
  
      ans1_1 = F.dot(n1, n2)
      ans1_2 = F.dot(n1, v2)
      ans1_3 = F.dot(v1, n2)
      assert_allclose(ans1_1.data, ref, atol=1e-3)
      assert_allclose(ans1_2.data, ref, atol=1e-3)
      assert_allclose(ans1_3.data, ref, atol=1e-3)
      with nn.auto_forward(is_dynamic):
          ans1_4 = F.dot(v1, v2)
          if is_dynamic:
              ans1_4.forward()
              assert_allclose(ans1_4.d, ref, atol=1e-3)
  
      out = ref.copy()
      F.dot(a1, a2, out)
      assert_allclose(out, ref, atol=1e-3)
  
      out1_1 = nn.NdArray(ans1_1.shape)
      out1_1.cast(np.float32)
      F.dot(n1, n2, out1_1)
      assert_allclose(out1_1.data, ref, atol=1e-3)
  
      out1_2 = nn.NdArray(ans1_2.shape)
      out1_2.cast(np.float32)
      F.dot(n1, v2, out1_2)
      assert_allclose(out1_2.data, ref, atol=1e-3)
  
      out1_3 = nn.NdArray(ans1_3.shape)
      out1_3.cast(np.float32)
      F.dot(v1, n2, out1_3)
      assert_allclose(out1_3.data, ref, atol=1e-3)
  
      out1_4 = nn.Variable(ans1_4.shape)
      out1_4.data.cast(np.float32)
      with nn.auto_forward(is_dynamic):
          F.dot(v1, v2, out1_4)
          if not is_dynamic:
              out1_4.forward()
          assert_allclose(out1_4.d, ref, atol=1e-3)
  
      # Ndarray with a wrong dtype
      out2_1 = nn.NdArray(ref.shape)
      out2_1.cast(int)
      out2_2 = nn.Variable(ref.shape)
      out2_2.data.cast(int)
      # should not exec
      with pytest.raises(ValueError) as excinfo:
          F.dot(n1, n2, out2_1)
          F.dot(n1, v2, out2_1)
          F.dot(v1, n2, out2_1)
          F.dot(v1, v2, out2_2)
  
file_path: nnabla/python/test/test_numpy_compat_functions.py
imports: import pytest
  import numpy
  import nnabla
  import nnabla.functions
  from nnabla.testing import assert_allclose
  from nbla_test_function_network import function_network_tester
label_desc: Use image node_id 2 for calling a global function with example usage: test_ndarray_dot(seed, shape, is_dynamic) without return types