add "update_by_batch" in gene;

add flatten_conns as an inverse function for unflatten_conns;
add "test_flatten.ipynb" as test for them.
This commit is contained in:
wls2002
2024-05-30 19:44:52 +08:00
parent cd92f411dc
commit 5bd6e5c357
9 changed files with 481 additions and 11 deletions

View File

@@ -120,3 +120,9 @@ class BaseGenome:
conns = conns.at[: len(conn_keys), 3:].set(random_conn_attrs)
return nodes, conns
def update_by_batch(self, state, batch_input, nodes, conns):
"""
Update the genome by a batch of data.
"""
raise NotImplementedError

View File

@@ -93,3 +93,6 @@ class DefaultGenome(BaseGenome):
return vals[self.output_idx]
else:
return self.output_transform(vals[self.output_idx])
def update_by_batch(self, state, batch_input, nodes, conns):
pass