Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

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

not useful #181

Open
LT1st opened this issue Feb 25, 2024 · 0 comments
Open

not useful #181

LT1st opened this issue Feb 25, 2024 · 0 comments

Comments

@LT1st
Copy link

LT1st commented Feb 25, 2024

To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Traceback (most recent call last):
File "D:\0code\IR_dataset\align\gen_seg_deeplab3.py", line 7, in
segment_image = semantic_segmentation()
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\pixellib\semantic_init_.py", line 26, in init
self.model = Deeplab_xcep_pascal()
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\pixellib\semantic\deeplab.py", line 205, in Deeplab_xcep_pascal
shape_before = tf.shape(x)
^^^^^^^^^^^
File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\lutao.conda\envs\seg\Lib\site-packages\keras\src\backend\common\keras_tensor.py", line 92, in tf_tensor
raise ValueError(
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant