Skip to content

Instantly share code, notes, and snippets.

@manashmandal
Created April 6, 2017 07:07
Show Gist options
  • Save manashmandal/4bd4ea45dafd9b459dede5aff107d21c to your computer and use it in GitHub Desktop.
Save manashmandal/4bd4ea45dafd9b459dede5aff107d21c to your computer and use it in GitHub Desktop.
from __future__ import print_function
import numpy as np
import tensorflow as tf
sess = tf.Session()
inp = tf.Variable(np.array([0.0, 0.0, 0.0, 0.0, 1.0]).reshape(1, 1, 5, 1), name="inp")
fil = tf.Variable(np.array([0.0, 0.5, 1.0]).reshape(1, 3, 1, 1), name="fil")
op = tf.nn.conv2d(inp, fil, strides=[1, 1, 1, 1], padding='SAME')
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
print("input")
print(input.eval())
print("filter")
print(filter.eval())
result = sess.run(op)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment