PsyNeuLink icon indicating copy to clipboard operation
PsyNeuLink copied to clipboard

Incorrect results in `test_params_for_modulatory_projection_in_parameter_port`

Open jvesely opened this issue 3 years ago • 0 comments

as reported in [0,1], appears to specific to self-hosted runners:

 TestCompositionRuntimeParams.test_params_for_modulatory_projection_in_parameter_port _
[gw4] darwin -- Python 3.8.12 /Users/psyneulink/actions-runner/_work/_temp/_venv/bin/python

self = <test_runtime_params.TestCompositionRuntimeParams object at 0x1323958b0>

    def test_params_for_modulatory_projection_in_parameter_port(self):
    
        T1 = TransferMechanism()
        T2 = TransferMechanism()
        CTL = ControlMechanism(control=ControlSignal(projections=('slope',T2)))
        C = Composition(pathways=[[T1,T2,CTL]])
    
        # Run 0
        C.run(inputs={T1: 2.0},
              runtime_params={
                  T2: {
                      PARAMETER_PORT_PARAMS: {
                          CONTROL_PROJECTION_PARAMS: {
                              'variable':(5, AtTrial(3)), # variable of all Projection to all ParameterPorts
                              'value':(10, AtTrial(4)),
                              'value':(21, AtTrial(5)),
                          },
                          # Test individual Projection specifications outside of type-specific dict
                          CTL.control_signals[0].efferents[0]: {'value':(32, AtTrial(6))},
                          'ControlProjection for TransferMechanism-1[slope]': {'value':(43, AtTrial(7))},
                      }
                  },
              },
              num_trials=8
              )
        CTL.control_signals[0].modulation = OVERRIDE
        # Run 1
        C.run(inputs={T1: 2.0},
              runtime_params={
                  T2: {
                      PARAMETER_PORT_PARAMS: {
                          CONTROL_PROJECTION_PARAMS: {
                              'value':(5, Any(AtTrial(0), AtTrial(2))),
                              'variable':(10, AtTrial(1)),
                              # Test individual Projection specifications inside of type-specific dict
                              'ControlProjection for TransferMechanism-1[slope]': {'value':(19, AtTrial(3))},
                              CTL.control_signals[0].efferents[0]: {'value':(33, AtTrial(4))},
                          },
                      }
                  },
              },
              num_trials=5
              )
    
>       assert np.allclose(C.results,[         # Conditions satisfied:
            np.array([[2]]),   # Run 0, Trial 0: None (2 input; no control since that requires a cycle)
            np.array([[4]]),   # Run 0, Trial 1: None (2 input * 2 control gathered last cycle)
            np.array([[8]]),   # Run 0, Trial 2: None (2 input * 4 control gathered last cycle)
            np.array([[10]]),  # Run 0, Trial 3: ControlProjection variable (2*5)
            np.array([[20]]),  # Run 0, Trial 4: ControlProjection value (2*10)
            np.array([[42]]),  # Run 0, Trial 5: ControlProjection value using Projection type-specific keyword (2*210)
            np.array([[64]]),  # Run 0, Trial 6: ControlProjection value using individual Projection (2*32)
            np.array([[86]]),  # Run 0, Trial 7: ControlProjection value using individual Projection by name (2*43)
            np.array([[10]]),  # Run 1, Tria1 0: ControlProjection value with OVERRIDE using value (2*5)
            np.array([[20]]),  # Run 1, Tria1 1: ControlProjection value with OVERRIDE using variable (2*10)
            np.array([[10]]),  # Run 1, Tria1 2: ControlProjection value with OVERRIDE using value again (in Any) (2*5)
            np.array([[38]]),  # Run 1, Tria1 3: ControlProjection value with OVERRIDE using individ Proj by name (2*19)
            np.array([[66]]),  # Run 1: Trial 4: ControlProjection value with OVERRIDE using individ Proj  (2*33)
        ])
E       assert False
E        +  where False = <function allclose at 0x102dbe160>([[array([2.])], [array([4.])], [array([8.])], [array([10.])], [array([20.])], [array([42.])], ...], [array([[2]]), array([[4]]), array([[8]]), array([[10]]), array([[20]]), array([[42]]), ...])
E        +    where <function allclose at 0x102dbe160> = np.allclose
E        +    and   [[array([2.])], [array([4.])], [array([8.])], [array([10.])], [array([20.])], [array([42.])], ...] = (Composition Composition-0).results

tests/composition/test_runtime_params.py:576: AssertionError

[0] https://github.com/PrincetonUniversity/PsyNeuLink/actions/runs/3434962081/jobs/5726782039 [1] https://github.com/PrincetonUniversity/PsyNeuLink/actions/runs/3434962081/jobs/5726782648

jvesely avatar Nov 10 '22 14:11 jvesely