question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT

See original GitHub issue

System information.

  • Have I written custom code (as opposed to using a stock example script provided in Keras): no
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
  • TensorFlow installed from (source or binary): binary
  • TensorFlow version (use command below): 2.9
  • Python version: 3.7
  • Bazel version (if compiling from source): N/A
  • GPU model and memory: N/A (CPU)
  • Exact command to reproduce:
  1. Open the notebook with Google Colab
  2. Run all cells
  3. View the runtime logs image Note: We have to upgrade Tensorflow and Keras to 2.9 manually in the notebook, because the current default version is not the latest one on Colab.

Describe the problem. (Continue the issue from tensorflow_issue_57052) I got a Type inference failed error when running tf.keras.Model.fit() in Tensorflow 2.9 and Keras 2.9. I didn’t see this kind of error in version 2.8 with the identical code. Although the program didn’t crash, I’m afraid that there will be some error in the trained model.

Describe the current behavior. Run tf.keras.Model.fit() and the error Type inference failed shows up.

Describe the expected behavior. The error shouldn’t show up.

Contributing.

  • Do you want to contribute a PR? (yes/no): no
  • If yes, please read this page for instructions
  • Briefly describe your candidate solution(if contributing):

Standalone code to reproduce the issue. Link to notebook: https://drive.google.com/file/d/1k78lpGVthB7nthEkYgUs3JNJTuR79r5E/view?usp=sharing To reproduce:

  1. Open the notebook with Google Colab
  2. Run all cells
  3. View the runtime logs

Source code / logs.

2022-08-20 17:18:05.533157: W tensorflow/core/common_runtime/forward_type_inference.cc:231] Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT: expected compatible input types, but input 1:
type_id: TFT_OPTIONAL
args {
  type_id: TFT_PRODUCT
  args {
    type_id: TFT_TENSOR
    args {
      type_id: TFT_BOOL
    }
  }
}
 is neither a subtype nor a supertype of the combined inputs preceding it:
type_id: TFT_OPTIONAL
args {
  type_id: TFT_PRODUCT
  args {
    type_id: TFT_TENSOR
    args {
      type_id: TFT_LEGACY_VARIANT
    }
  }
}

        while inferring type of node 'dice_loss/cond/output/_11'

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
tgsmith61591commented, Sep 20, 2022

@gadagashwini what’s the point of a warning if the response is simply you can safely ignore it.? It’s clearly there for a reason

4reactions
gadagashwinicommented, Sep 14, 2022

Hi @sky712345678, W tensorflow/core/common_runtime/forward_type_inference.cc:231] Type inference failed. is just a warning, you can safely ignore it. Given code executed without any error message. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type inference failed. This indicates an invalid graph ... - GitHub
Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT #57052.
Read more >
Type ERROR when upgrading to tensorflow 2.9 - Stack Overflow
I have seen the same type of error message appear in the output type ... the lines with the error by searching for...
Read more >
Issues and Errors when runing tensorflow on GPU, but not CPU.
W tensorflow/core/common_runtime/ · ] Type inference failed. This indicates an invalid graph that escaped type checking. Error message: INVALID_ARGUMENT: ...
Read more >
Custom pluggable types for ... - The Checker Framework Manual
The Nullness Checker issues this error message: Graph.java:14: error: [type.argument] incompatible types in type argument.
Read more >
'Type mismatch' error is not issued due to 'Type inference ...
You will get an error: type inference failed. The value of the type parameter T should be mentioned in input types (argument types,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found