-
@keras.saving.register_keras_serializable(package="MyLayers")
class CustomLayer(keras.layers.Layer):
def __init__(self, factor):
super().__init__()
self.factor = factor
def call(self, x):
return x * self.factor
def get_config(self):
return {"factor": self.factor} |
Beta Was this translation helpful? Give feedback.
Answered by
ghsanti
Jul 20, 2024
Replies: 1 comment
-
The Config won't be stored otherwise ig. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ghsanti
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
__init__
args of a custom layer must be declared in get config.If they aren't primitive types must be also serialised.
Config won't be stored otherwise ig.