AutoGraph could not transform <function simple_ml_inference_op_with_handle at 0x7fa17d6e85e0> and will run it as-is
Hi @FlorinAndrei ,

I have replicated the behaviour and we have to dig into more whether this is a bug or not. Reference [gist](https://colab.research.google.com/gist/SuryanarayanaY/f8f2e46b3bae1398327ef25cd5abc541/60426.ipynb) here.

I request you to set verbosity to 10 using command `export AUTOGRAPH_VERBOSITY=10` and submit the `logs` for us, As colab not generating complete logs(particularly at C++ level). This might be helpful to analyse the issue. Thanks!
  I seriously want to work on some issues please tell which issue should i pick and how to get my first pull request merged @SuryanarayanaY I did `export AUTOGRAPH_VERBOSITY=10` before launching the script with `python3 script_name.py`. This was on an Ubuntu 22.04 machine that I have ssh-ed into. The log output you see is all the output I got from the script.

Is there anything else I should do? Just let me know what you need. Hi @FlorinAndrei ,

From the error log,it seems this warning is due to the reason that may The Tensorflow seems does not have the access to the source code of the some of the function from TensorFlow Decision Forests (TF-DF) which is powered by Yggdrasil Decision Forests (YDF).Please refer this [source](https://www.tensorflow.org/decision_forests).
```
WARNING:tensorflow:AutoGraph could not transform <function simple_ml_inference_op_with_handle at 0x7fa17d6e85e0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: could not get source code
```

Also Tensorflow couldn't create Autograph for lambda functions which is known issue.

In fact this is just a warning to users let them know that autograph is not constructed for a particular function and running it as it is without graph.Yeah this have some performance implications but not sure this can be fixable or not especially when there are other libraries involved.For other library functions TF might have not access to Source code and this is causing this warning. This warning is visible in few official Tensorflow Tutorials also and I am attaching few for your references.Refer [source1](https://www.tensorflow.org/decision_forests/tutorials/model_composition_colab),[source2](https://www.tensorflow.org/decision_forests/tutorials/advanced_colab),[source3](https://www.tensorflow.org/decision_forests/tutorials/intermediate_colab) etc.

I hope this will provide some additional info for you. Thanks! The warning literally tells people to inform the TF team about it, which I did.

Either this requires some action from the TF team, or the warning needs to be removed (which is also "action required"). Hi @FlorinAndrei ,

I appreciate that you have reported as per the logs. I will escalate this to concern team and let you updated. Thanks! @FlorinAndrei ,

AFAIK Autograph cannot convert those functions for which source code is not available or those functions from third party libraries. However the log message also needs to look into whether we need to change this. We need to hear about this from the concerned SME.

Thanks > The warning literally tells people to inform the TF team about it, which I did.
> 
> Either this requires some action from the TF team, or the warning needs to be removed (which is also "action required").

But you can't really expect as it did require  > Hi @FlorinAndrei ,
> 
> From the error log,it seems this warning is due to the reason that may The Tensorflow seems does not have the access to the source code of the some of the function from TensorFlow Decision Forests (TF-DF) which is powered by Yggdrasil Decision Forests (YDF).Please refer this [source](https://www.tensorflow.org/decision_forests).
> 
> ```
> WARNING:tensorflow:AutoGraph could not transform <function simple_ml_inference_op_with_handle at 0x7fa17d6e85e0> and will run it as-is.
> Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
> Cause: could not get source code
> ```
> 
> Also Tensorflow couldn't create Autograph for lambda functions which is known issue.
> 
> In fact this is just a warning to users let them know that autograph is not constructed for a particular function and running it as it is without graph.Yeah this have some performance implications but not sure this can be fixable or not especially when there are other libraries involved.For other library functions TF might have not access to Source code and this is causing this warning. This warning is visible in few official Tensorflow Tutorials also and I am attaching few for your references.Refer [source1](https://www.tensorflow.org/decision_forests/tutorials/model_composition_colab),[source2](https://www.tensorflow.org/decision_forests/tutorials/advanced_colab),[source3](https://www.tensorflow.org/decision_forests/tutorials/intermediate_colab) etc.
> 
> I hope this will provide some additional info for you. Thanks!

Well this would make it quite obvious of the fact that the warning was referencing to action > @SuryanarayanaY I did `export AUTOGRAPH_VERBOSITY=10` before launching the script with `python3 script_name.py`. This was on an Ubuntu 22.04 machine that I have ssh-ed into. The log output you see is all the output I got from the script.
> 
> Is there anything else I should do? Just let me know what you need.

we will also need to ensure smooth functionality  Hi everyone,

TF-DF developer here. Thank you very much for reporting this! We just [fixed the issue at head](https://github.com/tensorflow/decision-forests/commit/2fc493c5e186d1a62d773c97385e09d6002b66a2) and the next version of TF-DF will include the fix.  awesome, thanks! Close the issue for now as the issue with TF-DF is fixed. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60426">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60426">No</a>

<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

No

### Source

binary

### Tensorflow Version

2.12.0

### Custom Code

Yes

### OS Platform and Distribution

Linux Ubuntu 22.04

### Mobile device

_No response_

### Python version

3.10.6

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

CPU only

### GPU model and memory

_No response_

### Current Behaviour?

Running `tensorflow_decision_forests` I saw a warning in the output while running `model.fit()` which asked me to file a bug report.

Prediction seems okay, but I cannot be 100% sure about it.

Dataset files needed to reproduce the case:

[train.csv](https://github.com/tensorflow/tensorflow/files/11346644/train.csv)

[test.csv](https://github.com/tensorflow/tensorflow/files/11346645/test.csv)

List of Python modules:

[pip_list.txt](https://github.com/tensorflow/tensorflow/files/11346651/pip_list.txt)


### Standalone code to reproduce the issue

```shell
import pandas as pd
import tensorflow_decision_forests as tfdf


def type_conversion_tfdf(df_orig):
    df = df_orig.copy(deep=True)

    df[["PassengerId_1", "PassengerId_2"]] = df["PassengerId"].str.split(
        pat="_", n=1, expand=True
    )
    df[["Name_First", "Name_Last"]] = df["Name"].str.split(pat=" ", n=1, expand=True)
    df[["Deck", "Cabin_Num", "Side"]] = df["Cabin"].str.split(pat="/", n=2, expand=True)

    bool_to_int_columns = ["Transported", "CryoSleep", "VIP"]
    for c in bool_to_int_columns:
        if c in df.columns.to_list():
            df[c] = df[c].fillna(value=0).astype(bool).astype(int)

    categorical_columns = [
        "HomePlanet",
        "Destination",
        "PassengerId_2",
        "Name_First",
        "Name_Last",
        "Deck",
        "Side",
    ]
    for c in categorical_columns:
        # df[c] = df[c].astype("category")
        pass

    int_columns = ["Cabin_Num"]
    for c in int_columns:
        df[c] = df[c].fillna(value=0).astype(int)

    return df.drop(columns=["PassengerId", "PassengerId_1", "Cabin", "Name"])


pd.options.mode.copy_on_write = True

train_df = pd.read_csv("train.csv")
test_df = pd.read_csv("test.csv")

train_df_tfdf = type_conversion_tfdf(train_df)
test_df_tfdf = type_conversion_tfdf(test_df)

train_ds_tfdf = tfdf.keras.pd_dataframe_to_tf_dataset(
    train_df_tfdf, label="Transported"
)
test_ds_tfdf = tfdf.keras.pd_dataframe_to_tf_dataset(test_df_tfdf)

rf = tfdf.keras.RandomForestModel()
rf.fit(x=train_ds_tfdf)

predictions = rf.predict(test_ds_tfdf)
```


### Relevant log output

```shell
2023-04-27 10:53:42.381793: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-04-27 10:53:42.848387: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
2023-04-27 10:53:43.514073: I tensorflow/compiler/xla/stream_executor/cuda/cuda_gpu_executor.cc:996] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero. See more at https://github.com/torvalds/linux/blob/v6.0/Documentation/ABI/testing/sysfs-bus-pci#L344-L355
2023-04-27 10:53:43.540254: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1956] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
Use /tmp/tmpsuc8grc3 as temporary training directory
Reading training dataset...
2023-04-27 10:53:43.603559: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_8' with dtype string and shape [8693]
         [[{{node Placeholder/_8}}]]
Training dataset read in 0:00:02.534852. Found 8693 examples.
Training model...
[INFO 23-04-27 10:54:06.0499 PDT kernel.cc:1242] Loading model from path /tmp/tmpsuc8grc3/model/ with prefix fd4ad06ed85c449e
[INFO 23-04-27 10:54:06.5441 PDT decision_forest.cc:660] Model loaded with 300 root(s), 292454 node(s), and 16 input feature(s).
[INFO 23-04-27 10:54:06.5441 PDT abstract_model.cc:1311] Engine "RandomForestGeneric" built
[INFO 23-04-27 10:54:06.5441 PDT kernel.cc:1074] Use fast generic engine
Model trained in 0:00:20.491433
Compiling model...
2023-04-27 10:54:06.630203: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_0' with dtype double and shape [8693]
         [[{{node Placeholder/_0}}]]
WARNING:tensorflow:AutoGraph could not transform <function simple_ml_inference_op_with_handle at 0x7fa17d6e85e0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: could not get source code
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
WARNING:tensorflow:AutoGraph could not transform <function simple_ml_inference_op_with_handle at 0x7fa17d6e85e0> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, `export AUTOGRAPH_VERBOSITY=10`) and attach the full output.
Cause: could not get source code
To silence this warning, decorate the function with @tf.autograph.experimental.do_not_convert
Model compiled.
2023-04-27 10:54:07.749903: I tensorflow/core/common_runtime/executor.cc:1197] [/device:CPU:0] (DEBUG INFO) Executor start aborting (this does not indicate an error and you can ignore this message): INVALID_ARGUMENT: You must feed a value for placeholder tensor 'Placeholder/_13' with dtype double and shape [4277]
         [[{{node Placeholder/_13}}]]
5/5 [==============================] - 0s 60ms/step
```
</details>