New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how does the get_shape
function work with placeholders?
#25
Comments
Try print(tf.Session().run(shape)) |
Hi vahidk. It seems not working because Here's a working example: def get_dyn_shape(tensor):
dynamic_shape = tf.unstack(tf.shape(tensor))
return dynamic_shape
a = tf.placeholder(tf.float32, [None, 128])
dyn_shape = get_dyn_shape(a)
print(tf.Session().run(dyn_shape, feed_dict={a:np.random.random((3, 128))})) But When I replace
Any suggestions? Also, I'm confused about when to use this |
This get_shape() function is not designed to be used for printing shapes. If you want to do that just use session.run(tf.shape(x)). The output of get_shape() is useful for creating other tensors. What it does is that it tries to keep the shape static if possible otherwise dynamic which can be useful at times. |
".values().get_shape()" or ".outputs.get_chape()" method worked! |
I tried The code exapmle
b = tf.placeholder(tf.float32, [None, 10, 32]); shape = get_shape(b)
,but when I print out the shape, it show tensor objects, rather than the dynamic/static shape as expected.
I wonder how can I use this
get_shape
function in a session properly in order to get a placeholder's shape?Thx!
The text was updated successfully, but these errors were encountered: