我是一个在用Tensorflow做机器学习毕设的本科生,ValueError: Tensor conversion requested dtype float32_ref for Tensor with dtype float32:'Tensor("Adam/dense/kernel/m/Initializer/zeros:0", shape=(256, 513), dtype=float32)这个问题最后是怎么解决的,大佬救一下。
我的错误
Traceback (most recent call last):
File "C:/python/machinelearning/venv/Include/RCFusion/code/train_and_eval.py", line 376, in
train_step_conv1x1 = tf.keras.optimizers.RMSprop(learning_rate=decayed_lr*lr_mult_conv1x1).get_updates(loss=loss, params=trainable_variables_conv1x1)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\keras\optimizer_v2\optimizer_v2.py", line 504, in get_updates
return [self.apply_gradients(grads_and_vars)]
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\keras\optimizer_v2\optimizer_v2.py", line 433, in apply_gradients
self._create_slots(var_list)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\keras\optimizer_v2\rmsprop.py", line 123, in _create_slots
self.add_slot(var, "rms")
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\keras\optimizer_v2\optimizer_v2.py", line 585, in add_slot
initial_value=initial_value)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\variables.py", line 260, in call
return cls._variable_v2_call(*args, **kwargs)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\variables.py", line 254, in _variable_v2_call
shape=shape)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\variables.py", line 235, in
previous_getter = lambda **kws: default_variable_creator_v2(None, **kws)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 2552, in default_variable_creator_v2
shape=shape)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\variables.py", line 262, in call
return super(VariableMetaclass, cls).call(*args, **kwargs)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 1406, in init
distribute_strategy=distribute_strategy)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\ops\resource_variable_ops.py", line 1538, in _init_from_args
name="initial_value", dtype=dtype)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1184, in convert_to_tensor
return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1242, in convert_to_tensor_v2
as_ref=False)
File "C:\python\machinelearning\venv\lib\site-packages\tensorflow_core\python\framework\ops.py", line 1273, in internal_convert_to_tensor
(dtype.name, value.dtype.name, value))
ValueError: Tensor conversion requested dtype float32_ref for Tensor with dtype float32: <tf.Tensor 'RMSprop/conv1x1/redux_rgb_res1_depth/kernel/rms/Initializer/zeros:0' shape=(1, 1, 64, 256) dtype=float32>
Process finished with exit code 1