def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
    x = T.matrix('x', dtype=dtypeInput)
    b = T.vector('b', dtype=dtypeBias)

    z = T.nnet.softmax_with_bias(x, b)

    f = theano.function([x, b], z, mode=mode_without_gpu)
    f_gpu = theano.function([x, b], z, mode=mode_with_gpu)
    assert f.maker.fgraph.toposort()[-1].op == T.nnet.softmax_with_bias
    assert isinstance(f_gpu.maker.fgraph.toposort()[-2].op,
                      GpuSoftmaxWithBias)

    def cmp(n, m):
        data = numpy.random.uniform(1e-7, 1, (n, m)).astype(dtype=dtypeInput)
        b_data = numpy.random.uniform(1e-7, 1, (m,)).astype(dtype=dtypeBias)

        out = f(data, b_data)
        gout = f_gpu(data, b_data)
        utt.assert_allclose(out, gout)

    cmp(2, 5)
    # we need to test n>32*1024 to check that we make the block loop.
    cmp(2 << 15, 5)
    cmp(4074, 400)
    cmp(784, 784)
    cmp(4, 1000)
    cmp(4, 1024)
    cmp(4, 2000)
    cmp(4, 2024)
    # GTX285 don't have enough shared mem for this case.
    cmp(4, 4074)
    # The GTX580, 680 and kepler don't have enough shared memory.
    cmp(2, 10000)
    cmp(128, 16 * 1024)
    cmp(128, 64 * 1024)
Use this in order to avoid deadlocking the event loop thread.
dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sandbox/gpuarray/tests/test_nnet.py/softmax_with_bias_unittest_template--crossover with--dataset/ETHPy150Open datastax/python-driver/cassandra/connection.py/Connection.set_keyspace_async