PsyNeuLink icon indicating copy to clipboard operation
PsyNeuLink copied to clipboard

typecheck-decorator crashes with np.array values of len > 1

Open kmantel opened this issue 3 years ago • 1 comments

example:

>>> pnl.Exponential(rate=[[0], [0]])
(Exponential Exponential Function-0)
>>> pnl.Exponential(rate=np.array([[0], [0]]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../PsyNeuLink/psyneulink/core/globals/parameters.py", line 483, in check_user_specified_wrapper
    return func(self, *args, **orig_kwargs)
  File ".../lib/python3.9/site-packages/typecheck/decorators.py", line 59, in typecheck_invocation_proxy
    if kwarg != fw.Checker.no_value:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

due to the typecheck at https://github.com/PrincetonUniversity/PsyNeuLink/blob/86c70a9c918df585985cfe17963abbb7958fc339/psyneulink/core/components/functions/nonstateful/transferfunctions.py#L634

I don't think this is something to spend time on but supports merging #2401

kmantel avatar Sep 30 '22 03:09 kmantel

typecheck-decorator has been removed. I think we can close this one, unless beartype has the same issue

jvesely avatar Apr 07 '23 04:04 jvesely