code: def test_resize():
      def _test_resize_with_diff_type(dtype):
          # test normal case
          data_in = np.random.uniform(0, 255, (300, 200, 3)).astype(
              dtype
          )
          out_nd = transforms.Resize(200)(data_in)
          data_expected = mx.image.imresize(data_in, 200, 200, 1)
          assert_almost_equal(out_nd.asnumpy(), data_expected.asnumpy())
          # test 4D input
          data_bath_in = np.random.uniform(
              0, 255, (3, 300, 200, 3)
          ).astype(dtype)
          out_batch_nd = transforms.Resize(200)(data_bath_in)
          for i in range(len(out_batch_nd)):
              assert_almost_equal(
                  mx.image.imresize(
                      data_bath_in[i], 200, 200, 1
                  ).asnumpy(),
                  out_batch_nd[i].asnumpy(),
              )
          # test interp = 2
          out_nd = transforms.Resize(200, interpolation=2)(data_in)
          data_expected = mx.image.imresize(data_in, 200, 200, 2)
          assert_almost_equal(out_nd.asnumpy(), data_expected.asnumpy())
          # test height not equals to width
          out_nd = transforms.Resize((200, 100))(data_in)
          data_expected = mx.image.imresize(data_in, 200, 100, 1)
          assert_almost_equal(out_nd.asnumpy(), data_expected.asnumpy())
          # test keep_ratio
          out_nd = transforms.Resize(150, keep_ratio=True)(data_in)
          data_expected = mx.image.imresize(data_in, 150, 225, 1)
          assert_almost_equal(out_nd.asnumpy(), data_expected.asnumpy())
          # test size below zero
          invalid_transform = transforms.Resize(-150, keep_ratio=True)
          assertRaises(MXNetError, invalid_transform, data_in)
          # test size more than 2:
          invalid_transform = transforms.Resize(
              (100, 100, 100), keep_ratio=True
          )
          assertRaises(MXNetError, invalid_transform, data_in)
  
      for dtype in ["uint8", "float32", "float64"]:
          _test_resize_with_diff_type(dtype)
  
imports: import os
  from collections import namedtuple
  from uuid import uuid4
  import numpy
  import mxnet
  from mxnet import gluon, autograd, np, npx
  from mxnet.test_utils import use_np, assert_almost_equal, check_gluon_hybridize_consistency, same, check_symbolic_backward
  from common import assertRaises, xfail_when_nonstandard_decimal_separator
  import random
  from mxnet.base import MXNetError
  from mxnet.gluon.data.vision import transforms
  from mxnet import image
  import pytest
label_desc: Use image node_id 3 for calling a global function with example usage: test_resize() without return types