Skip to content

add get_config and from_config methods #6

@jalalmzh

Description

@jalalmzh

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions