SHARE
TWEET

Untitled

a guest May 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---------------------------------------------------------------------------
  2. ValueError                                Traceback (most recent call last)
  3. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
  4.     510                 as_ref=input_arg.is_ref,
  5. --> 511                 preferred_dtype=default_dtype)
  6.     512           except TypeError as err:
  7.  
  8. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\framework\ops.py in internal_convert_to_tensor(value, dtype, name, as_ref, preferred_dtype, ctx, accept_symbolic_tensors)
  9.    1174     if ret is None:
  10. -> 1175       ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  11.    1176
  12.  
  13. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\framework\ops.py in _TensorTensorConversionFunction(t, dtype, name, as_ref)
  14.     976         "Tensor conversion requested dtype %s for Tensor with dtype %s: %r" %
  15. --> 977         (dtype.name, t.dtype.name, str(t)))
  16.     978   return t
  17.  
  18. ValueError: Tensor conversion requested dtype int32 for Tensor with dtype float32: 'Tensor("metrics_16/acc/Cast_6:0", shape=(?, 1), dtype=float32)'
  19.  
  20. During handling of the above exception, another exception occurred:
  21.  
  22. TypeError                                 Traceback (most recent call last)
  23. <ipython-input-26-7ccbae3113af> in <module>
  24.      58             model.compile(optimizer='adam',
  25.      59                          loss='sparse_categorical_crossentropy',
  26. ---> 60                          metrics=['accuracy'])
  27.      61             model.fit(X, y,
  28.      62                       batch_size=32,
  29.  
  30. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\training\checkpointable\base.py in _method_wrapper(self, *args, **kwargs)
  31.     440     self._setattr_tracking = False  # pylint: disable=protected-access
  32.     441     try:
  33. --> 442       method(self, *args, **kwargs)
  34.     443     finally:
  35.     444       self._setattr_tracking = previous_value  # pylint: disable=protected-access
  36.  
  37. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\engine\training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, distribute, **kwargs)
  38.     497           targets=self.targets,
  39.     498           skip_target_indices=skip_target_indices,
  40. --> 499           sample_weights=self.sample_weights)
  41.     500
  42.     501       # Prepare gradient updates and state updates.
  43.  
  44. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\engine\training.py in _handle_metrics(self, outputs, skip_target_indices, targets, sample_weights, masks, return_stateful_result)
  45.    1842                 output,
  46.    1843                 output_mask,
  47. -> 1844                 return_stateful_result=return_stateful_result))
  48.    1845         metric_results.extend(
  49.    1846             self._handle_per_output_metrics(
  50.  
  51. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\engine\training.py in _handle_per_output_metrics(self, metrics_dict, y_true, y_pred, mask, weights, return_stateful_result)
  52.    1799           # stateless fns.
  53.    1800           stateful_metric_result = _call_stateful_fn(stateful_fn)
  54. -> 1801           metric_result = _call_stateless_fn(metric_fn)
  55.    1802           _track_metric_tensors(metric_name, metric_result,
  56.    1803                                 stateful_metric_result)
  57.  
  58. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\engine\training.py in _call_stateless_fn(fn)
  59.    1775         def _call_stateless_fn(fn):
  60.    1776           weighted_metric_fn = training_utils.weighted_masked_objective(fn)
  61. -> 1777           return weighted_metric_fn(y_true, y_pred, weights=weights, mask=mask)
  62.    1778
  63.    1779         def _track_metric_tensors(name, stateless_result, stateful_result):
  64.  
  65. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\engine\training_utils.py in weighted(y_true, y_pred, weights, mask)
  66.     645     """
  67.     646     # score_array has ndim >= 2
  68. --> 647     score_array = fn(y_true, y_pred)
  69.     648     if mask is not None:
  70.     649       mask = math_ops.cast(mask, y_pred.dtype)
  71.  
  72. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\keras\metrics.py in binary_accuracy(y_true, y_pred, threshold)
  73.    1531   threshold = math_ops.cast(threshold, y_pred.dtype)
  74.    1532   y_pred = math_ops.cast(y_pred > threshold, y_pred.dtype)
  75. -> 1533   return K.mean(math_ops.equal(y_true, y_pred), axis=-1)
  76.    1534
  77.    1535
  78.  
  79. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\ops\gen_math_ops.py in equal(x, y, name)
  80.    3307   try:
  81.    3308     _, _, _op = _op_def_lib._apply_op_helper(
  82. -> 3309         "Equal", x=x, y=y, name=name)
  83.    3310   except (TypeError, ValueError):
  84.    3311     result = _dispatch.dispatch(
  85.  
  86. ~\Anaconda3\envs\venv\lib\site-packages\tensorflow\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords)
  87.     545                   "%s type %s of argument '%s'." %
  88.     546                   (prefix, dtypes.as_dtype(attrs[input_arg.type_attr]).name,
  89. --> 547                    inferred_from[input_arg.type_attr]))
  90.     548
  91.     549           types = [values.dtype]
  92.  
  93. TypeError: Input 'y' of 'Equal' Op has type float32 that does not match type int32 of argument 'x'.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top