Created
August 10, 2018 23:02
-
-
Save c0nn3r/f51845c1434beaa21467f435f0221719 to your computer and use it in GitHub Desktop.
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
def shape_list(x): | |
""" | |
deal with dynamic shape in tensorflow cleanly | |
""" | |
ps = x.get_shape().as_list() | |
ts = tf.shape(x) | |
return [ts[i] if ps[i] is None else ps[i] for i in range(len(ps))] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment