tf.io.read_file

Reads the contents of file.

Used in the notebooks

Used in the guide Used in the tutorials

This operation returns a tensor with the entire contents of the input filename. It does not do any parsing, it just returns the contents as they are. Usually, this is the first step in the input pipeline.

Example:

with open("/tmp/file.txt", "w") as f:
  f.write("asdf")

4
tf.io.read_file("/tmp/file.txt")
<tf.Tensor: shape=(), dtype=string, numpy=b'asdf'>

Example of using the op in a function to read an imag