0

I need to read a file in my train module into a np.array (i want to use the array as label_keys in a DNNClassifier).

I tried tf.read_file and tf.TextLineReader() but i can´t get them to just output the rows to a np.array.

Is it possible?

(why not just read a file with open? I´m training in GCS and want to get the file from storage :)

1 Answer 1

2

To access a file from GCS using TensorFlow, you can use the Python tf.gfile.GFile API, which acts like a regular Python file object, but allows you to use TensorFlow's filesystem connectors:

with tf.gfile.GFile("gs://...") as f:
  file_contents = f.read()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.