0
import tensorflow as tf

if __name__ == "__main__":
    weights = tf.get_variable(
        name="weights",
        shape=[9, 3, 1, 64],
        dtype=tf.float32,
        initializer=tf.truncated_normal_initializer()
    ),
    print(tf.shape(weights, name="weights_shape"))

Output:

Tensor("weights_shape:0", shape=(5,), dtype=int32)

Can't figure out why the shape of "weights" does not match the given shape.

Any help would be appreciated!

jdehesa
  • 58,456
  • 7
  • 77
  • 121
coco
  • 1
  • 2

1 Answers1

0

Oh my god!

found that this mystic error is just occurred by adding an extra "," after tf.get_variable()

But I am still curious why?

Bsquare ℬℬ
  • 4,423
  • 11
  • 24
  • 44
coco
  • 1
  • 2
  • adding a comma at the end of an expression is short-hand for creating a tuple, e.g. `a=3,` results in `a` being a tuple, so `a=3,` is equivalent to `a=(3,)` or `a=tuple(3)`. – nemo Dec 18 '18 at 10:13