finish jit-able speciate function

next time i'll create a new branch
This commit is contained in:
wls2002
2023-05-12 19:26:02 +08:00
parent 9b56f4ff73
commit 6006f92f3f
6 changed files with 212 additions and 54 deletions

View File

@@ -23,8 +23,6 @@ if __name__ == '__main__':
new_node_idx += len(pop_nodes)
pop_nodes, pop_connections = mutate_func(mutate_keys, pop_nodes, pop_connections, new_nodes)
pop_nodes, pop_connections = jax.device_get([pop_nodes, pop_connections])
# for i in range(len(pop_nodes)):
# check_array_valid(pop_nodes[i], pop_connections[i], input_idx, output_idx)
idx1 = np.random.permutation(len(pop_nodes))
idx2 = np.random.permutation(len(pop_nodes))
@@ -32,13 +30,6 @@ if __name__ == '__main__':
n2, c2 = pop_nodes[idx2], pop_connections[idx2]
crossover_keys = jax.random.split(subkey, len(pop_nodes))
# for idx, (zn1, zc1, zn2, zc2) in enumerate(zip(n1, c1, n2, c2)):
# n, c = crossover(crossover_keys[idx], zn1, zc1, zn2, zc2)
# try:
# check_array_valid(n, c, input_idx, output_idx)
# except AssertionError as e:
# crossover(crossover_keys[idx], zn1, zc1, zn2, zc2)
pop_nodes, pop_connections = crossover_func(crossover_keys, n1, c1, n2, c2)
for i in range(len(pop_nodes)):