code: def test_op_dropout(shape, dropout_rate, device_id, precision):
      from cntk import dropout
  
      count = 10
      resulted_non_zeros = 0
  
      # As the dropout node is stochastic, we run it a couple times and aggregate
      # over the results to get more stable tests.
      for i in range(count):
          value = np.ones(
              shape=shape, dtype=PRECISION_TO_TYPE[precision]
          )
  
          a = C.input_variable(
              shape=value.shape,
              dtype=sanitize_dtype_cntk(PRECISION_TO_TYPE[precision]),
              needs_gradient=True,
              name="a",
          )
  
          dropout_node = dropout(a, dropout_rate=dropout_rate)
  
          value.shape = (1,) + value.shape
          forward_input = {a: value}
  
          forward, backward = cntk_eval(
              dropout_node,
              forward_input,
              precision,
              cntk_device(device_id),
              backward_pass=True,
          )
  
          resulted_non_zeros += np.count_nonzero(
              forward[dropout_node.output]
          )
  
      resulted_non_zeros /= count
      num_elements = np.multiply.reduce(shape)
      expected_non_zeros = num_elements * (1 - dropout_rate)
      max_off = 0.2 * num_elements
  
      assert abs(resulted_non_zeros - expected_non_zeros) < max_off
  
imports: from __future__ import division
  import numpy
  import cntk
  import pytest
  from .ops_test_utils import unittest_helper, _test_unary_op, _test_binary_op, AA, precision, PRECISION_TO_TYPE, cntk_device
  from cntk.tests.test_utils import TOLERANCE_ABSOLUTE
  from cntk.internal.utils import eval
  from cntk.internal import sanitize_dtype_cntk
  from ..None import constant
  from cntk.variables import Parameter, Constant
label_desc: Use image node_id 7 for calling a global function with example usage: test_op_dropout(shape, dropout_rate, device_id, precision) without return types