code: def test_asnumpy_or_asscalar():
      # scalar float32
      assert asnumpy_or_asscalar(nd.array([1.2])) == np.float32(1.2)
      # scalar int32
      assert asnumpy_or_asscalar(
          nd.array([2], dtype=np.int32)
      ) == np.int32(2)
      # list of one scalar
      assert asnumpy_or_asscalar([nd.array([1.2])]) == [np.float32(1.2)]
      # list of multiple scalars
      assert asnumpy_or_asscalar(
          [nd.array([1.2]), nd.array([3.4])]
      ) == [np.float32([1.2]), np.float32([3.4])]
      # list of lists of scalars
      assert asnumpy_or_asscalar(
          [[nd.array([1.2])], [nd.array([3.4])]]
      ) == [[np.float32([1.2])], [np.float32([3.4])]]
      # tensor
      assert np.array_equal(
          asnumpy_or_asscalar(nd.array([[1.2], [3.4]])),
          np.array([[1.2], [3.4]], dtype=np.float32),
      )
      # tuple
      assert asnumpy_or_asscalar(
          ((nd.array([1.2]),), (nd.array([3.4]),))
      ) == (
          (np.array([1.2], dtype=np.float32),),
          (np.array([3.4], dtype=np.float32),),
      )
  
imports: import pytest
  import mxnet
  from mxnet import nd
  import numpy
  from rl_coach.architectures.mxnet_components.utils import *
label_desc: Use image node_id 2 for calling a global function with example usage: test_asnumpy_or_asscalar() without return types