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: Dimension 0 in both shapes must be equal, but are 1 and 16383. Shapes are [1] and [16383]. #68

Open
fycheng-code opened this issue Jul 18, 2019 · 5 comments

Comments

@fycheng-code
Copy link

I tried to train the data but ran into a ValueError at the end:

localhost:segan carson$ ./train_segan.sh
2019-07-18 10:52:31.580663: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
WARNING: Logging before flag parsing goes to stderr.
W0718 10:52:31.581701 4604413376 deprecation_wrapper.py:119] From main.py:122: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

Parsed arguments: {'logtostderr': <absl.flags._flag.BooleanFlag object at 0x1295a4278>, 'alsologtostderr': <absl.flags._flag.BooleanFlag object at 0x1295a8630>, 'log_dir': <absl.flags._flag.Flag object at 0x1295a86d8>, 'v': <absl.logging._VerbosityFlag object at 0x1295a8748>, 'verbosity': <absl.logging._VerbosityFlag object at 0x1295a8748>, 'stderrthreshold': <absl.logging._StderrthresholdFlag object at 0x1295a8828>, 'showprefixforinfo': <absl.flags._flag.BooleanFlag object at 0x1295a8940>, 'run_with_pdb': <absl.flags._flag.BooleanFlag object at 0x11262b0b8>, 'pdb_post_mortem': <absl.flags._flag.BooleanFlag object at 0x11262b2b0>, 'run_with_profiling': <absl.flags._flag.BooleanFlag object at 0x1295a8d68>, 'profile_file': <absl.flags._flag.Flag object at 0x1295a8e10>, 'use_cprofile_for_profiling': <absl.flags._flag.BooleanFlag object at 0x1295a8e48>, 'only_check_args': <absl.flags._flag.BooleanFlag object at 0x1295a8eb8>, 'op_conversion_fallback_to_while_loop': <absl.flags._flag.BooleanFlag object at 0x12aa03a90>, 'test_random_seed': <absl.flags._flag.Flag object at 0x12def6128>, 'test_srcdir': <absl.flags._flag.Flag object at 0x12def6278>, 'test_tmpdir': <absl.flags._flag.Flag object at 0x12def6470>, 'test_randomize_ordering_seed': <absl.flags._flag.Flag object at 0x12defb1d0>, 'xml_output_file': <absl.flags._flag.Flag object at 0x12defbb00>, 'seed': <absl.flags._flag.Flag object at 0x104eaa710>, 'epoch': <absl.flags._flag.Flag object at 0x133f1bcf8>, 'batch_size': <absl.flags._flag.Flag object at 0x133f1bda0>, 'save_freq': <absl.flags._flag.Flag object at 0x133f1be48>, 'canvas_size': <absl.flags._flag.Flag object at 0x133f1bef0>, 'denoise_epoch': <absl.flags._flag.Flag object at 0x133f1bf98>, 'l1_remove_epoch': <absl.flags._flag.Flag object at 0x133f63080>, 'bias_deconv': <absl.flags._flag.BooleanFlag object at 0x133f630b8>, 'bias_downconv': <absl.flags._flag.BooleanFlag object at 0x133f63160>, 'bias_D_conv': <absl.flags._flag.BooleanFlag object at 0x133f631d0>, 'denoise_lbound': <absl.flags._flag.Flag object at 0x133f632b0>, 'noise_decay': <absl.flags._flag.Flag object at 0x133f63358>, 'd_label_smooth': <absl.flags._flag.Flag object at 0x133f63400>, 'init_noise_std': <absl.flags._flag.Flag object at 0x133f634a8>, 'init_l1_weight': <absl.flags._flag.Flag object at 0x133f63550>, 'z_dim': <absl.flags._flag.Flag object at 0x133f635f8>, 'z_depth': <absl.flags._flag.Flag object at 0x133f636a0>, 'save_path': <absl.flags._flag.Flag object at 0x133f63748>, 'g_nl': <absl.flags._flag.Flag object at 0x133f637b8>, 'model': <absl.flags._flag.Flag object at 0x133f63860>, 'deconv_type': <absl.flags._flag.Flag object at 0x133f63908>, 'g_type': <absl.flags._flag.Flag object at 0x133f63978>, 'g_learning_rate': <absl.flags._flag.Flag object at 0x133f63a20>, 'd_learning_rate': <absl.flags._flag.Flag object at 0x133f63a90>, 'beta_1': <absl.flags._flag.Flag object at 0x133f63b00>, 'preemph': <absl.flags._flag.Flag object at 0x133f63ba8>, 'synthesis_path': <absl.flags._flag.Flag object at 0x133f63c50>, 'e2e_dataset': <absl.flags._flag.Flag object at 0x133f63cc0>, 'save_clean_path': <absl.flags._flag.Flag object at 0x133f63d30>, 'test_wav': <absl.flags._flag.Flag object at 0x133f63da0>, 'weights': <absl.flags._flag.Flag object at 0x133f63e10>, '?': <absl.app.HelpFlag object at 0x133f63e48>, 'help': <absl.app.HelpFlag object at 0x133f63e48>, 'helpshort': <absl.app.HelpshortFlag object at 0x133f63eb8>, 'helpfull': <absl.app.HelpfullFlag object at 0x133f63f28>, 'helpxml': <absl.app.HelpXMLFlag object at 0x133f63f98>}
W0718 10:52:31.582546 4604413376 deprecation_wrapper.py:119] From main.py:75: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

Using device: /device:CPU:0
W0718 10:52:31.582683 4604413376 deprecation_wrapper.py:119] From main.py:86: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

Creating GAN model
*** Applying pre-emphasis of 0.95 ***
W0718 10:52:31.587827 4604413376 deprecation_wrapper.py:119] From /Users/carson/Desktop/aikesiman/segan/ops.py:30: The name tf.summary.scalar is deprecated. Please use tf.compat.v1.summary.scalar instead.

W0718 10:52:31.590809 4604413376 deprecation_wrapper.py:119] From /Users/carson/Desktop/aikesiman/segan/model.py:123: The name tf.train.RMSPropOptimizer is deprecated. Please use tf.compat.v1.train.RMSPropOptimizer instead.

W0718 10:52:31.591068 4604413376 deprecation_wrapper.py:119] From /Users/carson/Desktop/aikesiman/segan/ops.py:309: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

W0718 10:52:31.591166 4604413376 deprecation.py:323] From /Users/carson/Desktop/aikesiman/segan/model.py:151: string_input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(string_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
W0718 10:52:31.595031 4604413376 deprecation.py:323] From /Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py:278: input_producer (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensor_slices(input_tensor).shuffle(tf.shape(input_tensor, out_type=tf.int64)[0]).repeat(num_epochs). If shuffle=False, omit the .shuffle(...).
W0718 10:52:31.595695 4604413376 deprecation.py:323] From /Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py:190: limit_epochs (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.Dataset.from_tensors(tensor).repeat(num_epochs).
W0718 10:52:31.596957 4604413376 deprecation.py:323] From /Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py:199: QueueRunner.init (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
W0718 10:52:31.597701 4604413376 deprecation.py:323] From /Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/input.py:199: add_queue_runner (from tensorflow.python.training.queue_runner_impl) is deprecated and will be removed in a future version.
Instructions for updating:
To construct input pipelines, use the tf.data module.
W0718 10:52:31.600240 4604413376 deprecation.py:323] From /Users/carson/Desktop/aikesiman/segan/data_loader.py:23: TFRecordReader.init (from tensorflow.python.ops.io_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by tf.data. Use tf.data.TFRecordDataset.
W0718 10:52:31.601068 4604413376 deprecation_wrapper.py:119] From /Users/carson/Desktop/aikesiman/segan/data_loader.py:25: The name tf.parse_single_example is deprecated. Please use tf.io.parse_single_example instead.

W0718 10:52:31.601160 4604413376 deprecation_wrapper.py:119] From /Users/carson/Desktop/aikesiman/segan/data_loader.py:28: The name tf.FixedLenFeature is deprecated. Please use tf.io.FixedLenFeature instead.

Traceback (most recent call last):
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1864, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 1 and 16383. Shapes are [1] and [16383].
From merging shape 0 with other shapes. for 'device_0/concat/concat_dim' (op: 'Pack') with input shapes: [1], [16383].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 122, in
tf.app.run()
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/absl/app.py", line 300, in run
_run_main(main, args)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/absl/app.py", line 251, in _run_main
sys.exit(main(argv))
File "main.py", line 89, in main
se_model = SEGAN(sess, FLAGS, udevices)
File "/Users/carson/Desktop/aikesiman/segan/model.py", line 118, in init
self.build_model(args)
File "/Users/carson/Desktop/aikesiman/segan/model.py", line 134, in build_model
self.build_model_single_gpu(idx)
File "/Users/carson/Desktop/aikesiman/segan/model.py", line 154, in build_model_single_gpu
self.preemph)
File "/Users/carson/Desktop/aikesiman/segan/data_loader.py", line 39, in read_and_decode
wave = tf.cast(pre_emph(wave, preemph), tf.float32)
File "/Users/carson/Desktop/aikesiman/segan/data_loader.py", line 10, in pre_emph
concat = tf.concat(0, [x0, diff])
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/dispatch.py", line 180, in wrapper
return target(*args, **kwargs)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1296, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1087, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1145, in convert_to_tensor_v2
as_ref=False)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1224, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1145, in _autopacking_conversion_function
return _autopacking_helper(v, dtype, name or "packed")
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/array_ops.py", line 1095, in _autopacking_helper
return gen_array_ops.pack(elems_as_tensors, name=scope)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 5897, in pack
"Pack", values=values, axis=axis, name=name)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2027, in init
control_input_ops)
File "/Users/carson/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1867, in _create_c_op
raise ValueError(str(e))
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 16383. Shapes are [1] and [16383].
From merging shape 0 with other shapes. for 'device_0/concat/concat_dim' (op: 'Pack') with input shapes: [1], [16383].

@ucasiggcas
Copy link

Dear,
I also have the same question,
Did you solve the problem ?
Could you please help me ?

@ucasiggcas
Copy link

ValueError: Dimension 0 in both shapes must be equal, but are 1 and 16383. Shapes are [1] and [16383]. From merging shape 0 with other shapes. for 'device_0/concat/concat_dim' (op: 'Pack') with input shapes: [1], [16383].

@Nitin4525
Copy link

I have this error, too. And I guess it maybe raise since my software version is higher than its requirement

@vladimirsvsv77
Copy link

I solved the same problem reinstalling Tensorflow.
Try pip install tensorflow==0.12

@glebss
Copy link

glebss commented Sep 23, 2019

I had the same problem.
The problem is in tf.concat() function in different versions of tensorflow. In tensorflow version 0.12 it takes arguments as tf.concat(axis, values) but in later versions it's tf.concat(values, axis).
The solution is either reinstall tensorflow as @vladimirsvsv77 mentioned or change code a little.

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

5 participants