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

add get_config and from_config methods #6

Open
jalalmzh opened this issue May 26, 2024 · 1 comment
Open

add get_config and from_config methods #6

jalalmzh opened this issue May 26, 2024 · 1 comment

Comments

@jalalmzh
Copy link

jalalmzh commented May 26, 2024

if you want to save and load models that contain this layers you shoud add get_config and from_config methods to custom layers like this

  def get_config(self):
           config = super(DenseKAN, self).get_config()
           config.update({'units':self.units ,
                               'grid_size':self.grid_size,
                               'spline_order':self.spline_order,
                               'grid_range':self.grid_range,
                               'basis_activation':self.basis_activation,
                               'use_bias':self.use_bias,
                               'spline_initialize_stddev':self.spline_initialize_stddev})       
          return config    
   @classmethod
    def from_config(cls, config):
       return cls(**config)

and register them by "tf.keras.utils.get_custom_objects()['DenseKAN'] = DenseKAN"

@ZPZhou-lab
Copy link
Owner

thasks for feedback, I will add these two methods into each KAN layer.🫡

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

2 participants