Missing step in CSV reading and decoding

I am trying to read and decode a CSV file, using elementary operations. I can read the file with ReadFile. Then the result is a dimensionless string tensor that has the whole file in it as one string.
This cannot be decoded into tensors with DecodeCSV, as its input should be a 1 dimensional string tensor, where every element of the tensor is one line of the file.
If I manually create this 1 dimensional tensor then DecodeCSV works as intended.

So, what I am missing is another elementary step to split the output of ReadFile (dimensionless string tensor) into individual lines (1 dimensional string tensor) to be the input of DecodeCSV. Can someone help, how to do it?


P.S. I wanted to add on it a tag “help_request”, but do not know how…

Hi @Zsolt_Szakaly, Before using tf.io.decode_csv you can use tf.strings.split(f, ‘\n’) to split lines, then you can pass those lines to tf.io.decode_csv. Thank You.