DeepSVDD example giving me error #553
Unanswered
DrSouthmountain
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am trying to run the DeepSVDD algorithm on a dataset but a keep getting an error.
The same error pops up when running the sample code from the repo (deepsvdd_example.py). When running the sample code and fitting data I get the following:
line 25, in
clf.fit(X_train)
File "/opt/homebrew/Caskroom/miniforge/base/envs/ADPy311/lib/python3.11/site-packages/pyod/models/deep_svdd.py", line 270, in fit
self.model_ = self._build_model(training=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/ADPy311/lib/python3.11/site-packages/pyod/models/deep_svdd.py", line 201, in _build_model
dist = tf.math.reduce_sum((x - self.c) ** 2, axis=-1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/ADPy311/lib/python3.11/site-packages/tensorflow/python/ops/weak_tensor_ops.py", line 88, in wrapper
return op(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/ADPy311/lib/python3.11/site-packages/tensorflow/python/util/traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/opt/homebrew/Caskroom/miniforge/base/envs/ADPy311/lib/python3.11/site-packages/keras/src/backend/common/keras_tensor.py", line 91, 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.layersandkeras.operations). You are likely doing something like:What you should do instead is wrap
tf_fnin a layer:Has anyone run into the same problem? Any pointers on how I can fix it?
Beta Was this translation helpful? Give feedback.
All reactions