code: def test_is_train():
      x = mx.nd.ones((10, 10))
      x.attach_grad()
      with record(train_mode=True):
          assert is_recording()
          assert is_training()
          y = mx.nd.Dropout(x, p=0.5)
          assert y.asnumpy().max() == 2 and y.asnumpy().min() == 0
          y.backward()
          assert (x.grad.asnumpy() == y.asnumpy()).all()
  
          with predict_mode():
              assert is_recording()
              assert not is_training()
              y = mx.nd.Dropout(x, p=0.5)
              assert (y.asnumpy() == x.asnumpy()).all()
              y.backward(train_mode=False)
              assert (x.grad.asnumpy() == x.asnumpy()).all()
  
      with record(train_mode=False):
          assert is_recording()
          assert not is_training()
          y = mx.nd.Dropout(x, p=0.5)
          assert (y.asnumpy() == x.asnumpy()).all()
          y.backward(train_mode=False)
          assert (x.grad.asnumpy() == x.asnumpy()).all()
  
          with train_mode():
              assert is_recording()
              assert is_training()
              y = mx.nd.Dropout(x, p=0.5)
              assert y.asnumpy().max() == 2 and y.asnumpy().min() == 0
              y.backward()
              assert (x.grad.asnumpy() == y.asnumpy()).all()
  
      assert not is_recording()
      assert not is_training()
      y = mx.nd.Dropout(x, p=0.5)
      assert (y.asnumpy() == x.asnumpy()).all()
  
      with train_mode():
          assert not is_recording()
          assert is_training()
          y = mx.nd.Dropout(x, p=0.5)
          assert y.asnumpy().max() == 2 and y.asnumpy().min() == 0
  
imports: import functools
  import mxnet.ndarray
  from mxnet.ndarray import zeros_like
  from mxnet.autograd import *
  from mxnet.test_utils import *
  from common import xfail_when_nonstandard_decimal_separator
  from mxnet.test_utils import environment
  import pytest
label_desc: Use image node_id 13 for calling a global function with example usage: test_is_train() without return types