Skip to content

Instantly share code, notes, and snippets.

@currypurin
Created August 26, 2017 10:45
Show Gist options
  • Save currypurin/765c2a67b90d448147bc153cd7bf3f82 to your computer and use it in GitHub Desktop.
Save currypurin/765c2a67b90d448147bc153cd7bf3f82 to your computer and use it in GitHub Desktop.
import numpy as np
import tensorflow as tf
x_vals = np.array([1., 3., 5., 7., 9.])
# Create the TensorFlow Placceholder
x_data = tf.placeholder(tf.float32)
# Constant for multilication
m = tf.constant(3.)
prod = tf.multiply(x_data, m)
for x_val in x_vals:
print(sess.run(prod, feed_dict={x_data: x_val}))
>3.0
>9.0
>15.0
>21.0
>27.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment