In [1]:
import keras.backend as K


Using TensorFlow backend.

In [2]:
'TensorFlow version: ' + K.tf.__version__


Out[2]:
'TensorFlow version: 1.4.0'

Concatenate


In [3]:
K.eval(K.concatenate([K.random_uniform(shape=(3, 4)),
                      K.random_uniform(shape=(3, 4))], axis=0)).shape


Out[3]:
(6, 4)

In [4]:
K.eval(K.concatenate([K.random_uniform(shape=(3, 4)),
                      K.random_uniform(shape=(3, 4))], axis=1)).shape


Out[4]:
(3, 8)

Stack


In [5]:
K.eval(K.stack([K.random_uniform(shape=(3, 4)),
                K.random_uniform(shape=(3, 4))], axis=0)).shape


Out[5]:
(2, 3, 4)

In [6]:
K.eval(K.stack([K.random_uniform(shape=(3, 4)),
                K.random_uniform(shape=(3, 4))], axis=1)).shape


Out[6]:
(3, 2, 4)

In [7]:
K.eval(K.stack([K.random_uniform(shape=(3, 4)),
                K.random_uniform(shape=(3, 4))], axis=2)).shape


Out[7]:
(3, 4, 2)