Skip to content

Instantly share code, notes, and snippets.

@AtsushiSuzuki
Created October 21, 2017 10:57
Show Gist options
  • Save AtsushiSuzuki/831b522fcbb1ec6ef2304997feb98005 to your computer and use it in GitHub Desktop.
Save AtsushiSuzuki/831b522fcbb1ec6ef2304997feb98005 to your computer and use it in GitHub Desktop.
import tensorflow as tf
import numpy as np
x = np.array([1., 2., 3., 4.])
y = np.array([0., -1., -2, -3])
fn = tf.estimator.inputs.numpy_input_fn(
{"x": x}, y, batch_size=4, num_epochs=None, shuffle=True)
sess = tf.Session()
features, target = fn()
for name in features:
print(str.format("feature {}: {}", name, sess.run(features[name])))
print(str.format("target: {}", sess.run(target)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment