我有这个问题,我无法解决。有人遇到过同样的问题吗?我用的是windows 10Tensorflow 2
这是我运行的命令:python test.py——model_architecture ds_cnn——model_size_info 5 64 10 4 2 2 64 3 3 1 1 64 3 3 1 1 64 3 3 1 1——dct_系数ent_count 10——window_size_ms 40——window_stride_ms 20——checkpoint ./Pretrained_models/ds_cnn/DS_CNN_S/ckpt/ds_cnn_0.94_ckpt
Untarring speech_commands_v0.02.tar.gz...
Running testing on validation set...Traceback (most recent call last):
File "C:Usersxanaconda3envsnewenvtlibsite-packagestensorflowpythonutildispatch.py",
line 206, in wrapper
return target(*args, **kwargs)
File "C:Usersxanaconda3envsnewenvtlibsite-packagestensorflowpythonopsmath_ops.py",
line 1838, in tensor_not_equals
return gen_math_ops.not_equal(self, other, incompatible_shape_error=False)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopsgen_math_ops.py", line 6573, in not_equal
ctx=_ctx)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopsgen_math_ops.py", line 6601, in not_equal_eager_fallback
_attr_T, _inputs_T = _execute.args_to_matching_eager([x, y], ctx, [])
File "C:Usersxanaconda3envsnewenvtlibsite-packagestensorflowpythoneagerexecute.py",
line 280, in args_to_matching_eager
ret = [ops.convert_to_tensor(t, dtype, ctx=ctx) for t in l]
File "C:Usersxanaconda3envsnewenvtlibsite-packagestensorflowpythoneagerexecute.py",
line 280, in
ret = [ops.convert_to_tensor(t, dtype, ctx=ctx) for t in l]
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonprofilertrace.py", line 163, in wrapped
return func(*args, **kwargs)
File "C:Usersxanaconda3envsnewenvtlibsite-packagestensorflowpythonframeworkops.py",
line 1566, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonframeworkconstant_op.py", line 339, in
_constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonframeworkconstant_op.py", line 265, in constant
allow_broadcast=True)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonframeworkconstant_op.py", line 276, in _constant_impl
return _constant_eager_impl(ctx, value, dtype, shape, verify_shape)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonframeworkconstant_op.py", line 301, in _constant_eager_impl
t = convert_to_eager_tensor(value, ctx, type)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonframeworkconstant_op.py", line 98, in convert_to_eager_tensor
return ops.EagerTensor(value, ctx.device_name, type)
ValueError: TypeError: object of type 'RaggedTensor' has no len()
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 182, in
test()
File "test.py", line 48, in test
val_data = audio_processor.get_data(audio_processor.Modes.VALIDATION).batch(FLAGS.batch_size)
File "C:UsersxDropboxDocumentsxCodingKWStflu-kws-cortex-mTrainingdata.py", line
190, in get_data
use_background = (self.background_data != []) and (mode == AudioProcessor.Modes.TRAINING)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonutildispatch.py", line 210, in wrapper
result = dispatch(wrapper, args, kwargs)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonutildispatch.py", line 122, in dispatch
result = dispatcher.handle(args, kwargs)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopsraggedragged_dispatch.py", line 219, in handle
ragged_tensor_shape.RaggedTensorDynamicShape.from_tensor(y))
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopsraggedragged_tensor_shape.py", line 470, in
broadcast_dynamic_shape
shape_x = shape_x.broadcast_dimension(axis, shape_y.dimension_size(axis))
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopsraggedragged_tensor_shape.py", line 351, in
broadcast_dimension
condition, data=broadcast_err, summarize=10)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonutildispatch.py", line 206, in wrapper
return target(*args, **kwargs)
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonutiltf_should_use.py", line 247, in wrapped
return _add_should_use_warning(fn(*args, **kwargs),
File "C:Usersxanaconda3envsnewenvtlibsite-
packagestensorflowpythonopscontrol_flow_ops.py", line 164, in Assert
(condition, "n".join(data_str)))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Expected 'tf.Tensor(False,
shape=(), dtype=bool)' to be true. Summarized data: b'Unable to broadcast: dimension
size mismatch in dimension'
1
b'lengths='
0
b'dim_size='
1522930, 988891, 980062, 960000, 978488, 960000`
谢谢
问题是TensorFlow兼容性。从TensorFlow 2.5降级到2.3修复了这个问题。