`pytypes` error/bug: can't have `ndarray` within `Params` or `Hyperparams`
pytypes is giving me a hard time by not allowing me to have fields of ndarray type in Params and Hyperparams.
This minimal example reproduces the runtime error:
from d3m_metadata.container.numpy import ndarray
from d3m_metadata import params
class Params(params.Params):
state: ndarray
params = Params(state = ndarray([1,2,3]))
Traceback (most recent call last):
File "test.py", line 7, in <module>
params = Params(state = ndarray([1,2,3]))
File "/usr/local/lib/python3.6/site-packages/d3m_metadata/params.py", line 81, in __init__
if not utils.is_instance(value, value_type):
File "/usr/local/lib/python3.6/site-packages/d3m_metadata/utils.py", line 112, in is_instance
return type_util._isinstance(obj, cls, bound_typevars={})
File "/usr/local/lib/python3.6/site-packages/pytypes/type_util.py", line 1489, in _isinstance
if obj == {}:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
This turned out to be a big obstacle for implementing several TA1 primitives. If anyone knows a workaround or solution, it would greatly help.
Edited by Atılım Güneş Baydin