add save and load function for classes.

This commit is contained in:
wls2002
2024-06-09 20:33:02 +08:00
parent 374c05f5b7
commit 52e5d603f5
13 changed files with 70 additions and 42 deletions

View File

@@ -1,8 +1,8 @@
import jax, jax.numpy as jnp
from utils import State
from utils import State, StatefulBaseClass
class BaseGene:
class BaseGene(StatefulBaseClass):
"Base class for node genes or connection genes."
fixed_attrs = []
custom_attrs = []
@@ -10,9 +10,6 @@ class BaseGene:
def __init__(self):
pass
def setup(self, state=State()):
return state
def new_identity_attrs(self, state):
# the attrs which do identity transformation, used in mutate add node
raise NotImplementedError