def test_join_inplace():
 s = tensor.lscalar()
 x = tensor.vector('x')
 z = tensor.zeros((s,))
 join = Join(view=0)
 c = join(0, x, z, z)
 f = theano.function([theano.In(x, borrow=True), s], theano.Out(c, borrow=True))
 data = numpy.array([3, 4, 5], dtype=theano.config.floatX)
 print(f(data, 0))
 if (theano.config.mode not in ['DebugMode', 'DEBUG_MODE']):
  assert (f(data, 0) is data)
 assert numpy.allclose(f(data, 0), [3, 4, 5])

def test_join_inplace ( ) : s = tensor . lscalar ( ) x = tensor . vector ( 'x' ) z = tensor . zeros ( ( s , ) ) join = Join ( view = 0 ) c = join ( 0 , x , z , z ) f = theano . function ( [ theano . In ( x , borrow = True ) , s ] , theano . Out ( c , borrow = True ) ) data = numpy . array ( [ 3 , 4 , 5 ] , dtype = theano . config . floatX ) print ( f ( data , 0 ) ) if ( theano . config . mode not in [ 'DebugMode' , 'DEBUG_MODE' ] ) : assert ( f ( data , 0 ) is data ) assert numpy . allclose ( f ( data , 0 ) , [ 3 , 4 , 5 ] )
test join to work inplace .