code: def test_sequence_mask():
      for in_shape in (5, 10), (3, 4, 5, 4):
          for axis in [0, 1]:
              for mask_value in [0.0, 1.0]:
                  max_length = in_shape[axis]
                  batch_size = in_shape[1 - axis]
                  A = te.placeholder(
                      shape=in_shape, dtype="float32", name="A"
                  )
                  B = te.placeholder(
                      shape=(batch_size,), dtype="int32", name="B"
                  )
                  C = topi.sequence_mask(
                      A, B, axis=axis, mask_value=mask_value
                  )
                  A_data = np.random.normal(0, 1, in_shape).astype(
                      np.float32
                  )
                  B_data = np.random.randint(
                      1, max_length, (batch_size,)
                  ).astype(np.int32)
                  C_gt_data = tvm.topi.testing.sequence_mask(
                      A_data, B_data, mask_value, axis
                  )
  
                  def check_device(target, dev):
                      tvm_A = tvm.nd.array(A_data, dev)
                      tvm_B = tvm.nd.array(B_data, dev)
                      tvm_C = tvm.nd.empty(
                          in_shape, device=dev, dtype="float32"
                      )
                      print("Running on target: %s" % target)
                      with tvm.target.Target(target):
                          s = tvm.topi.testing.get_injective_schedule(
                              target
                          )(C)
                      f = tvm.build(
                          s, [A, B, C], target, name="SequenceMask"
                      )
                      f(tvm_A, tvm_B, tvm_C)
                      tvm.testing.assert_allclose(
                          tvm_C.numpy(), C_gt_data
                      )
  
                  for backend, dev in tvm.testing.enabled_targets():
                      check_device(backend, dev)
  
imports: import numpy
  import pytest
  import tvm
  from tvm import te
  from tvm import topi
  from tvm import relay
  import tvm.topi.testing
  from tvm.contrib.nvcc import have_fp16
  import tvm.testing
label_desc: Use image node_id 51 for calling a global function with example usage: test_sequence_mask() without return types