Reputation: 21
I'm trying to create a Transformer Model, I have 2 np.arrays
, both have strings, I used them to create a list of tuples
The format of the tuple is :
class 'tuple' (tf.Tensor: shape=(), dtype=string, numpy=b'abc', tf.Tensor: shape=(), dtype=string, numpy=b'xyz')
I want to combine these tuples to form tensorflow.python.data.ops.dataset_ops._OptionsDataset
, how can I do that?
Or is there any other way I could do it?
New to this, thanks for your help!
Upvotes: 1
Views: 1581
Reputation: 2507
You can use tensor_from_slices
. Here.
EDIT
Example
# Two tensors can be combined into one Dataset object.
values1 = tf.constant(['A', 'B', 'A']) # ==> 3x1 tensor
values2 = tf.constant(['A', 'B', 'A']) # ==> 3x1 tensor
dataset = Dataset.from_tensor_slices((values1, values2))
Upvotes: 2