添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
奔放的黄瓜  ·  Using node-fetch with ...·  3 天前    · 
刚毅的围巾  ·  Instance created by ...·  2 天前    · 
迷茫的领结  ·  Logstash-input-beats ...·  昨天    · 
风流倜傥的大蒜  ·  业务动态·  3 月前    · 
英俊的铁板烧  ·  Boomi User Community·  4 月前    · 

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 TypeError: Input 'y' of 'Sub' Op has type int32 that does not match type float32 of argument 'x'. #51242 TypeError: Input 'y' of 'Sub' Op has type int32 that does not match type float32 of argument 'x'. #51242 tranduchuy682 opened this issue Aug 5, 2021 · 3 comments
  • Done on Google Colab using TF 2.5
  • I have done with building model but these some problem when training. The errors are not clear enough I have no idea about which causes these errors.

    Traceback is:

    Epoch 1/5
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/autograph/impl/api.py:376: UserWarning: CRF decoding models have serialization issues in TF >=2.5 . Please see isse #2476
      return py_builtins.overload_of(f)(*args)
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    <ipython-input-27-1b7e06547f26> in <module>()
          1 history = MODEL.fit(X_tr, np.array(y_tr), batch_size=BATCH_SIZE, epochs=EPOCHS,
    ----> 2                     validation_split=0.1, verbose=2)
    9 frames
    /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
        984           except Exception as e:  # pylint:disable=broad-except
        985             if hasattr(e, "ag_error_metadata"):
    --> 986               raise e.ag_error_metadata.to_exception(e)
        987             else:
        988               raise
    TypeError: in user code:
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py:855 train_function  *
            return step_function(self, iterator)
        /usr/local/lib/python3.7/dist-packages/keras/losses.py:142 __call__  *
            losses = call_fn(y_true, y_pred)
        <ipython-input-25-f9adc600d49b>:7 call  *
            mse = tf.math.reduce_mean(tf.square(y_true - y_pred))
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/math_ops.py:1250 binary_op_wrapper
            raise e
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/math_ops.py:1234 binary_op_wrapper
            return func(x, y, name=name)
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/util/dispatch.py:206 wrapper
            return target(*args, **kwargs)
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/math_ops.py:548 subtract
            return gen_math_ops.sub(x, y, name)
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/ops/gen_math_ops.py:10562 sub
            "Sub", x=x, y=y, name=name)
        /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/op_def_library.py:558 _apply_op_helper
            inferred_from[input_arg.type_attr]))
        TypeError: Input 'y' of 'Sub' Op has type int32 that does not match type float32 of argument 'x'.
    

    Link to colab: https://colab.research.google.com/drive/1eRN8yxM4TyQ7JmO-hxjM76dIQz2_Hpga?usp=sharing
    Link to dataset: https://drive.google.com/file/d/1cVRPolctpCgcQontLDm8OmNHUMBM1KSp/view?usp=sharing

    Please help me with fixing this bug.