python - tf.string_split for a tensor of strings -
i have tensor looks like
x = [b'1 2 3 4 5' b'3 2 1' b'1 2']
how can split single strings of tensor numbers? when apply tf.string_split(x)
following error:
typeerror: failed convert object of type <class 'tensorflow.python.framework.sparse_tensor.sparsetensor'> tensor. contents: sparsetensor(indices=tensor("stringsplit_1:0", shape=(?, 2), dtype=int64), values=tensor("stringsplit_1:1", shape=(?,), dtype=string), dense_shape=tensor("stringsplit_1:2", shape=(2,), dtype=int64)). consider casting elements supported type.
when try tf.string_split(x).values
, following tensor: x = [b'1' b'2' b'3' b'4' b'5' b'3 b'2 b'1' b'1 b'2']
this not want because information numbers belong gone. want this
x = [[b'1' b'2' b'3' b'4' b'5'] [b'3' b'2' b'1'] [b'1' b'2']]
to cast these tf.string_to_number
int32 in next step.
can me?
Comments
Post a Comment