Skip to content

Commit

Permalink
[skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jdcpni committed Nov 25, 2024
1 parent 7cc2672 commit cc55248
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions psyneulink/library/compositions/emcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ def field_weights_setter(field_weights, owning_component=None, context=None):
raise EMCompositionError(f"The number of field_weights ({len(field_weights)}) must match the number of fields "
f"{len(owning_component.field_weights)}")
if owning_component.normalize_field_weights:
denominator = np.sum(np.where(field_weights is not None, field_weights, 0))
denominator = np.sum(np.where(field_weights is not None, field_weights, 0)) or 1
field_weights = [fw / denominator if fw is not None else None for fw in field_weights]

# Assign new fields_weights to default_variable of field_weight_nodes
Expand Down Expand Up @@ -2387,8 +2387,8 @@ def _construct_match_nodes(self, memory_template, memory_capacity, concatenate_q
MappingProjection(name=f'MEMORY for {self.key_names[i]} [KEY]',
sender=self.query_input_nodes[i].output_port,
matrix = np.array(memory_template[:,key_idx].tolist()).transpose().astype(float),
function=MatrixTransform(operation=args[i][OPERATION],
normalize=args[i][NORMALIZE])))
function=MatrixTransform(operation=args[key_idx][OPERATION],
normalize=args[key_idx][NORMALIZE])))
field.match_node = (ProcessingMechanism(name=self.key_names[i] + MATCH_TO_KEYS_AFFIX,
input_ports= {INPUT_SHAPES:memory_capacity,
PROJECTIONS: memory_projection}))
Expand Down
1 change: 1 addition & 0 deletions tests/composition/test_emcomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -1091,3 +1091,4 @@ def construct_em(field_weights):
else:
construct_em(field_weights)


0 comments on commit cc55248

Please sign in to comment.