Concatenating the input numpy array with one-hot vector of itself

Hello everyone

So i am trying to create synthetic data for low resource MT. So, for that i am building an encoder-decoder framework where the input numpy array will be one-hot encoded to itself and then will be fed into the encoder and decoder. It will be something similar to Conditional VAE.

input_array=input_array+one-hot-encode(input_array), the same thing will be done for the decoder end

I am doing something like this but it is not working:

def _add_encoder_input(self):
    x= Input(shape=self.input_shape, name="encoder_input")
    x = tf.concat(tf.cast([x, tf.one_hot(x, 1)], tf.int32), 1)
    return x

Any kind of help would be greatly appreciated

Thank you


I see you are using TensorFlow ops so I suppose you are using OpenNMT-tf, is that correct?

What do you mean by the “input array” here? Is it the sequence of token IDs?