import theano
import numpy as np
import theano.tensor as T
ones = theano.shared(np.float32([[1,2,3],[4,5,6],[7,8,9]]))
print(ones.get_value())
result = T.concatenate([ones,ones],axis=0)
print(result.eval())
result = T.concatenate([ones,ones],axis=1)
print(result.eval())
结果:
[[ 1. 2. 3.]
[ 4. 5. 6.]
[ 7. 8. 9.]]
[[ 1. 2. 3.]
[ 4. 5. 6.]
[ 7. 8. 9.]
[ 1. 2. 3.]
[ 4. 5. 6.]
[ 7. 8. 9.]]
[[ 1. 2. 3. 1. 2. 3.]
[ 4. 5. 6. 4. 5. 6.]
[ 7. 8. 9. 7. 8. 9.]]