Shuklaswag
Shuklaswag

Reputation: 1023

Concat two 2D tensors

I have a simple enough TensorFlow operation I need to execute, but I can't think of how to do it.

Currently, I have my data in a Tensor of the following format:

[[a0], [a1], [a2], ...]

I would like to convert that data into the following format:

[[1-a0, a0], [1-a1, a1], [1-a2, a2], ...]

There is probably a really simple solution that I lack the vocabulary to discover - would appreciate if I could be directed to it.

Upvotes: 1

Views: 440

Answers (1)

cs95
cs95

Reputation: 403198

I think you can use tf.concat:

tf.concat([1 - x, x], axis=1)
# <tf.Tensor 'concat:0' shape=(3, 2) dtype=int32>

Upvotes: 2

Related Questions