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

ValueError: Shape must be rank 2 but is rank 3 for 'concat' (op: 'ConcatV2') with input shapes: [?,16], [?,1,16], [] #10

Open
kodlan opened this issue Mar 1, 2020 · 0 comments

Comments

@kodlan
Copy link

kodlan commented Mar 1, 2020

Hi,

I'm trying to train text classifier using train_langdetect.shwithout horovod installed.
And I'm getting this error:

  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1607, in _create_c_op
    c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 2 but is rank 3 for 'concat' (op: 'ConcatV2') with input shapes: [?,16], [?,1,16], [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "classifier.py", line 199, in <module>
    tf.app.run()
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/absl/app.py", line 299, in run
    _run_main(main, args)
  File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/absl/app.py", line 250, in _run_main
    sys.exit(main(argv))
  File "classifier.py", line 193, in main
    FastTrain()
  File "classifier.py", line 167, in FastTrain
    estimator.train(input_fn=train_input, steps=FLAGS.train_steps, hooks=hooks)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 370, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1161, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1191, in _train_model_default
    features, labels, ModeKeys.TRAIN, self.config)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_estimator/python/estimator/estimator.py", line 1149, in _call_model_fn
    model_fn_results = self._model_fn(features=features, **kwargs)
  File "classifier.py", line 118, in model_fn
    input_layer = tf.concat([text_embedding, ngram_embedding], -1)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/util/dispatch.py", line 180, in wrapper
    return target(*args, **kwargs)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 1420, in concat
    return gen_array_ops.concat_v2(values=values, axis=axis, name=name)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 1257, in concat_v2
    "ConcatV2", values=values, axis=axis, name=name)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
    op_def=op_def)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op
    attrs, op_def, compute_device)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
    op_def=op_def)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1770, in __init__
    control_input_ops)
  File "/Users/kodlan/tensorflow_venv/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op
    raise ValueError(str(e))
ValueError: Shape must be rank 2 but is rank 3 for 'concat' (op: 'ConcatV2') with input shapes: [?,16], [?,1,16], [].```


Do you have any suggestions what could be causing this?
Thank you.
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

1 participant