code: def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
      # This is basic test for GpuCrossentropySoftmaxArgmax1HotWithBias
      # We check that we loop when their is too much threads
  
      n_in = 1000
      batch_size = 4097
      n_out = 1250
  
      if not isinstance(mode_with_gpu, theano.compile.DebugMode):
          n_in = 4098
          n_out = 4099
  
      y = T.lvector("y")
  
      b = T.fvector("b")
  
      # we precompute the dot with big shape before to allow the test of
      # GpuCrossentropySoftmax1HotWithBiasDx to don't fail with the error
      # (the launch timed out and was terminated) on GPU card not
      # powerful enough. We need the big shape to check for corner
      # case.
      dot_result = T.fmatrix("dot_result")
  
      # Seed numpy.random with config.unittests.rseed
      utt.seed_rng()
  
      xx = np.asarray(
          np.random.rand(batch_size, n_in), dtype=np.float32
      )
      yy = np.ones((batch_size,), dtype="int32")
      b_values = np.zeros((n_out,), dtype="float32")
      W_values = np.asarray(
          np.random.rand(n_in, n_out), dtype="float32"
      )
  
      dot_value = np.asarray(np.dot(xx, W_values), dtype="float32")
      del W_values
      p_y_given_x = T.nnet.softmax(dot_result + b)
      y_pred = T.argmax(p_y_given_x, axis=-1)
      loss = -T.mean(T.log(p_y_given_x)[T.arange(y.shape[0]), y])
      dW = T.grad(loss, dot_result)
      classify = theano.function(
          inputs=[y, b, dot_result],
          outputs=[loss, y_pred, dW],
          mode=mode_without_gpu,
      )
      classify_gpu = theano.function(
          inputs=[y, b, dot_result],
          outputs=[loss, y_pred, dW],
          mode=mode_with_gpu,
      )
  
      assert any(
          [
              isinstance(
                  node.op, T.nnet.CrossentropySoftmaxArgmax1HotWithBias
              )
              for node in classify.maker.fgraph.toposort()
          ]
      )
      assert any(
          [
              isinstance(
                  node.op, GpuCrossentropySoftmaxArgmax1HotWithBias
              )
              for node in classify_gpu.maker.fgraph.toposort()
          ]
      )
  
      out = classify(yy, b_values, dot_value)
      gout = classify_gpu(yy, b_values, dot_value)
  
      assert len(out) == len(gout) == 3
      utt.assert_allclose(out[0], gout[0])
      utt.assert_allclose(out[2], gout[2], atol=3e-6)
      utt.assert_allclose(out[1], gout[1])
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import unittest
  import theano
  import theano.tensor
  import theano.tests.unittest_tools
  from .config import mode_with_gpu, mode_without_gpu
  from ..nnet import GpuCrossentropySoftmaxArgmax1HotWithBias, GpuCrossentropySoftmax1HotWithBiasDx, GpuSoftmaxWithBias, GpuSoftmax
label_desc: Use image node_id 1 for calling a global function with example usage: test_GpuCrossentropySoftmaxArgmax1HotWithBias() without return types