import tensorflow as tf

            Z2 = tf.matmul(Z, A[:,:,n_basis//2:,:])/tf.sqrt(n_basis*.5)
            # Compute u_{h+1} and v_{h+1}
            U, V = tf.cos(Z1)+tf.cos(Z2), tf.sin(Z1)+tf.sin(Z2)
            Z = tf.concat([U, V], 3)/tf.sqrt(n_out*1.)
