Skip to content
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

Can not squeeze dim[3], expected a dimension of 1, got 2 for 'generator/Squeeze' #4

Open
lyzhangjm opened this issue Jun 25, 2017 · 11 comments

Comments

@lyzhangjm
Copy link

Hi, when I run the generate,
.sg_upconv(dim=2, act='sigmoid', bn=False).sg_squeeze()
there is a error:
ValueError: Can not squeeze dim[3], expected a dimension of 1, got 2 for 'generator/Squeeze' (op: 'Squeeze') with input shapes: [?,384,1,2].
what is it?
thank you.

@YazhouZhang0709
Copy link

@lyzhangjm Hi, did you solve this problem? I met the same error here.

@lyzhangjm
Copy link
Author

@YazhouZhang0709 , I have not solved the problem. I don't know the reason.

@zhiweiSunday
Copy link

@YazhouZhang0709 Hi,I have also met this problem.Do you have any method to solve this?

@jchook
Copy link

jchook commented Dec 10, 2017

I am also getting this issue after a successful train on 100k rows. Same error in both Python 2.7 and 3.5.

It seems the issue may be a Tensorflow version mismatch. Seems there have been some breaking changes.

Traceback (most recent call last):
  File "generate.py", line 55, in <module>
    .sg_upconv(dim=2, act='sigmoid', bn=False).sg_squeeze())
  File "/usr/local/lib/python2.7/dist-packages/sugartensor/sg_main.py", line 170, in wrapper
    out = func(tensor, tf.sg_opt(kwargs))
  File "/usr/local/lib/python2.7/dist-packages/sugartensor/sg_transform.py", line 119, in sg_squeeze
    return tf.squeeze(tensor, opt.axis, name=opt.name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 2394, in squeeze
    return gen_array_ops._squeeze(input, axis, name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 5202, in _squeeze
    "Squeeze", input=input, squeeze_dims=squeeze_dims, name=name)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Can not squeeze dim[3], expected a dimension of 1, got 2 for 'generator/Squeeze' (op: 'Squeeze') with input shapes: [?,384,1,2].

@jeanjerome
Copy link

Hi, did anybody solves that ?
Stop at same error with tensorflow 1.0.0 as sugartensor requirement.
That's a real bag of bones between variable parameters values and hard-coded values...

@buriburisuri Any help on that ?

@jeanjerome
Copy link

Well, found that to make it work but should be used with caution !!

@yiyetingyu
Copy link

I met the same problem, I don't know how to solve it.

@maakvolunteer
Copy link

raise ValueError(err.message)
ValueError: Can not squeeze dim[2], expected a dimension of 1, got 150 for 'QAModel/Squeeze_300' (op: 'Squeeze') with input shapes: [?,300,150].

@anshen666
Copy link

@lyzhangjm Hi, did you solve this problem? I met the same error here.

你好,请问你解决了这个问题了吗?可以和你交流一下吗?我的邮箱:[email protected] 微信:loveanshen QQ:519838354

@anshen666
Copy link

I met the same problem, I don't know how to solve it.

你好,请问你解决了这个问题了吗?可以和你交流一下吗?我的邮箱:[email protected] 微信:loveanshen QQ:519838354

@ouzzane
Copy link

ouzzane commented Jul 27, 2020

avez-vous résolu ce problème? J'ai rencontré la même erreur ici
tensorflow.python.framework.errors_impl.InvalidArgumentError: Can not squeeze dim[3], expected a dimension of 1, got 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants