human
I wrote the below code

    class TestOp(scalar.ScalarOp, ):
        def __init__(self):
            self.output_types_preference = scalar.upgrade_to_float
        def impl(self, n, x):
            return (x * n)
        def grad(self, inputs, gout):
            (n, x) = inputs
            (gz,) = gout
            dy_dx = n
            return [theano.gradient.grad_not_implemented(self, 0, n), (gz * dy_dx)]
    test_op = tensor.Elemwise(TestOp())
    x = tensor.scalar()
    tensor.grad(test_op(2, x), x)
    try:
        tensor.grad(test_op(x, 2), x)
        assert False
    except theano.gradient.NullTypeGradError:
        pass

What's a good function header?

Here's a good function header?
assistant
#Here's a good function header.

def test_not_implemented_elemwise_grad():