Last active
June 18, 2017 16:30
-
-
Save AndreCAndersen/d65878c1445c4decf06ae1fb61a32a9f to your computer and use it in GitHub Desktop.
Testing of map_fn in tensorflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
f1 = lambda x: x*1 | |
f2 = lambda x: x*2 | |
f3 = lambda x: x*3 | |
x = [f1, f2, f3] | |
y = [1, 2, 3] | |
result = list(map(lambda x,y: x(y), x, y)) | |
print(result) | |
# [1, 4, 9] | |
y = tf.constant([1, 2, 3]) | |
f = tf.map_fn(lambda x,y: x(y), (x, y)) | |
sess = tf.Session() | |
result = sess.run(f) | |
print(result) | |
# TypeError: Expected binary or unicode string, got <function <lambda> at 0x00000190E9C31C80> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment