DataCanvasIO / DeepTables

DeepTables: Deep-learning Toolkit for Tabular data
https://deeptables.readthedocs.io
Apache License 2.0
671 stars 118 forks source link

A KerasTensor cannot be used as input to a TensorFlow function #93

Open jp-varela opened 4 months ago

jp-varela commented 4 months ago

After messing around, I could not use the package on my case. So I tried to run locally your your binary classification example from here: https://deeptables.readthedocs.io/en/latest/examples.html#binary-classification

And I am getting the same error as in my use case.

System information

Describe the current behavior ValueError: A KerasTensor cannot be used as input to a TensorFlow function. A KerasTensor is a symbolic placeholder for a shape and dtype, used when constructing Keras Functional models or Keras Functions. You can only use it as input to a Keras layer or a Keras operation (from the namespaces keras.layers and keras.operations). You are likely doing something like:

x = Input(...)
...
tf_fn(x)  # Invalid.

What you should do instead is wrap tf_fn in a layer:


class MyLayer(Layer):
    def call(self, x):
        return tf_fn(x)

x = MyLayer()(x)`

**Standalone code to reproduce the issue**
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Jupyter notebook.
oaksharks commented 4 months ago

@jp-varela I have not replicated this issue since unable to install TensorFlow=2.8 on Python 3.10. You can retry using TensorFlow=2.9