fix bug in crossover: the child from two normal networks should always be normal.
This commit is contained in:
@@ -85,11 +85,14 @@ class DefaultNodeGene(BaseNodeGene):
|
||||
(node1[4] != node2[4])
|
||||
)
|
||||
|
||||
def forward(self, attrs, inputs):
|
||||
def forward(self, attrs, inputs, is_output_node=False):
|
||||
bias, res, act_idx, agg_idx = attrs
|
||||
|
||||
z = agg(agg_idx, inputs, self.aggregation_options)
|
||||
z = bias + res * z
|
||||
z = act(act_idx, z, self.activation_options)
|
||||
|
||||
# the last output node should not be activated
|
||||
if not is_output_node:
|
||||
z = act(act_idx, z, self.activation_options)
|
||||
|
||||
return z
|
||||
|
||||
Reference in New Issue
Block a user