def test_elemwise_collapse7(atol=1e-06):
 shape = (5, 4, 1)
 a = cuda_ndarray.CudaNdarray(theano._asarray(numpy.random.rand(*shape), dtype='float32'))
 a = theano._asarray(numpy.random.rand(*shape), dtype='float32')
 a2 = tcn.shared_constructor(a.copy(), 'a')
 a3 = a2.dimshuffle(0, 'x', 1, 2)
 f = pfunc([], [(a3 + 2)], mode=mode_with_gpu)
 out = f()[0]
 ans = (a + 2).reshape(shape[0], 1, shape[1], shape[2])
 assert numpy.allclose(out, ans, atol=atol)

def test_elemwise_collapse7 ( atol = 1e-06 ) : shape = ( 5 , 4 , 1 ) a = cuda_ndarray . CudaNdarray ( theano . _asarray ( numpy . random . rand ( * shape ) , dtype = 'float32' ) ) a = theano . _asarray ( numpy . random . rand ( * shape ) , dtype = 'float32' ) a2 = tcn . shared_constructor ( a . copy ( ) , 'a' ) a3 = a2 . dimshuffle ( 0 , 'x' , 1 , 2 ) f = pfunc ( [ ] , [ ( a3 + 2 ) ] , mode = mode_with_gpu ) out = f ( ) [ 0 ] ans = ( a + 2 ) . reshape ( shape [ 0 ] , 1 , shape [ 1 ] , shape [ 2 ] ) assert numpy . allclose ( out , ans , atol = atol )
test when one input have one broadcastable dimension and the other is a scalar .