code: def test_embedding():
      def check_embedding():
          layer = gluon.nn.Embedding(10, 100)
          layer.initialize()
          x = mx.np.array([3, 4, 2, 0, 1])
          with mx.autograd.record():
              y = layer(x)
              y.backward()
          assert (layer.weight.grad().asnumpy()[:5] == 1).all()
          assert (layer.weight.grad().asnumpy()[5:] == 0).all()
  
      def check_embedding_large_input():
          embedding = mx.gluon.nn.Embedding(10, 1)
          embedding.initialize()
          embedding.hybridize()
          shape = (20481,)
          with mx.autograd.record():
              emb_in = embedding(mx.np.ones(shape))
              loss = emb_in.sum()
          loss.backward()
          assert embedding.weight.grad().sum().item() == 20481
  
      check_embedding()
      check_embedding_large_input()
  
imports: from __future__ import absolute_import
  from __future__ import division
  import os
  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, assert_allclose
  from mxnet.gluon import nn
  from mxnet.base import MXNetError
  import random
  import pytest
label_desc: Use image node_id 26 for calling a global function with example usage: test_embedding() without return types