Home > other >  Model in keras. Fit error (), please take a look
Model in keras. Fit error (), please take a look

Time:03-12

ValueError: Tensor conversion requested dtype float32_ref for Tensor with dtype float32: 'Tensor (" Adam/dense/kernel/m/, Initializer zeros: 0 ", shape=(256, 513), a dtype=float32)'

To ask what situation is this?
The model fit (X_train y_train, batch_size=batch_size, epochs=200)
It went wrong,
It says the problem of data types, but the whole process I was tf. Float32, I don't know what is wrong

Complete error is as follows:
ValueError Traceback (the most recent call last)

- & gt; 1 the model fit (X_train y_train, batch_size=batch_size, epochs=200)

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ engine \ training py fit in (self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq, max_queue_size, workers, use_multiprocessing, * * kwargs)
778 validation_steps=validation_steps,
779 validation_freq=validation_freq,
- & gt; 780 steps_name='steps_per_epoch')
781
782 def the evaluate (self,

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ engine \ training_arrays py in model_iteration (model, the inputs, the targets, sample_weights batch_size, epochs, verbose, callbacks, val_inputs, val_targets, val_sample_weights, shuffle, initial_epoch, steps_per_epoch, validation_steps, validation_freq, mode, validation_in_fit, prepared_feed_values_from_dataset, steps_name, * * kwargs)
155
156 # Get step function and loop type.
- & gt; 157 f=_make_execution_function (model, mode)
158 use_steps=is_dataset or steps_per_epoch is not None
159 do_validation=val_inputs is not None

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ engine \ training_arrays py in _make_execution_function (model, mode)
530 if model. _distribution_strategy:
531 return distributed_training_utils. _make_execution_function (model, mode)
- & gt; 532 the return model. _make_execution_function (mode)
533
534

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ engine \ training py in _make_execution_function (self, mode)
2274 def _make_execution_function (self, mode) :
2275 if mode==ModeKeys. "TRAIN" :
-> 2276 self. _make_train_function ()
2277 the return of the self. Train_function
2278 if mode==ModeKeys. TEST:

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ engine \ training py in _make_train_function (self)
2217 # Training updates
2218 updates=self. Optimizer. Get_updates (
-> 2219 params=self _collected_trainable_weights, loss=self. Total_loss)
2220 # Unconditional updates
2221 updates +=self. Get_updates_for (None)

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ optimizer_v2 \ optimizer_v2 py in get_updates (self, loss, params)
495 if g is not None and v.d type!=dtypes. Resource
496])
- & gt; 497 return [self. Apply_gradients (grads_and_vars)]
498
499 def _set_hyper (self, name, value) :

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ optimizer_v2 \ optimizer_v2 py in apply_gradients (self, grads_and_vars, name)
433 _=self. Iterations
434 self. _create_hypers ()
- & gt; 435 self. _create_slots (var_list)
436
437 self. _prepare (var_list)

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ optimizer_v2 \ Adam py in _create_slots (self, var_list)
143 # Separate the for - loops to new one the ordering of slot variables from v1.
144 for var in var_list:
- & gt; 145 self. Add_slot (var, 'm')
146 for var in var_list:
147 self. Add_slot (var, 'v')

D: \ python \ lib \ site - packages \ tensorflow \ python \ keras \ optimizer_v2 \ optimizer_v2 py in add_slot (self, var, slot_name, initializer)
576 dtype=var. Dtype,
577 trainable=False,
- & gt; 578 initial_value=https://bbs.csdn.net/topics/initial_value)
579 backend. Track_variable (weight)
580 slot_dict [slot_name]=weight

D: \ python \ lib \ site - packages \ tensorflow \ python \ ops \ variables py in __call__ (CLS, * args, * * kwargs)
The return of 259 CLS. _variable_v1_call (* args, * * kwargs)
260 elif CLS is Variable:
- & gt; The return of 261 CLS. _variable_v2_call (* args, * * kwargs)
262 else:
263 return super (VariableMetaclass, CLS). __call__ (* args, * * kwargs)

D: \ python \ lib \ site - packages \ tensorflow \ python \ ops \ variables py in _variable_v2_call (CLS, initial_value, trainable, validate_shape caching_device, name, variable_def, dtype, import_scope, constraint, synchronization, aggregation, shape)
253 synchronization=synchronization,
254 aggregation=aggregation,
- & gt; 255 shape=shape)
256
257 def __call__ (CLS, * args, * * kwargs) :

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related