0
votes

I am following the view on youtube here,

it shows the code

text_1 = tf.ragged.constant(
    [['who','is', 'Goerge', 'Washington'],
     ['What', 'is', 'the', 'weather', 'tomorrow']])
text_2 = tf.ragged.constant(['goodnight'])

text = tf.concat(text_1, text_2)
print(text)

But it raises the ValueError as follows:

ValueError: Tensor conversion requested dtype int32 for Tensor with dtype string:

What is wrong please?

1

1 Answers

0
votes

In the docs it says that concat takes a list of tensors and an axis as arguments, like so

text = tf.concat([text_1, text_2], axis=-1)

This raises a ValueError because the shapes of the tensors don't match. Please specify what you want to achieve.

Edit:

In the video you linked to there appears to be a syntax error in this line: text_2 = tf.ragged.constant(['goodnight']]). (The brackets don't match.) It should really be text_2 = tf.ragged.constant([['goodnight']]), which achieves the result printed below the operation in the video.