Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created August 1, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasaarholt/68bba1bb8b0618be40f8c901f6488a03 to your computer and use it in GitHub Desktop.
Save thomasaarholt/68bba1bb8b0618be40f8c901f6488a03 to your computer and use it in GitHub Desktop.
gufunc error with whitespace in dask
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/var/folders/yt/z22_f0896l74f8gs3_20vc_00000gn/T/ipykernel_88946/1449311839.py in <module>
7 return np.linalg.inv(x)
8
----> 9 y = gufoo(b)
~/mambaforge/envs/py/lib/python3.9/site-packages/dask/array/gufunc.py in __call__(self, *args, **kwargs)
659
660 def __call__(self, *args, **kwargs):
--> 661 return apply_gufunc(
662 self.pyfunc,
663 self.signature,
~/mambaforge/envs/py/lib/python3.9/site-packages/dask/array/gufunc.py in apply_gufunc(func, signature, axes, axis, keepdims, output_dtypes, output_sizes, vectorize, allow_rechunk, meta, *args, **kwargs)
356 if vectorize:
357 otypes = [x.dtype for x in meta] if isinstance(meta, tuple) else [meta.dtype]
--> 358 func = np.vectorize(func, signature=signature, otypes=otypes)
359
360 ## Miscellaneous
~/mambaforge/envs/py/lib/python3.9/site-packages/numpy/lib/function_base.py in __init__(self, pyfunc, otypes, doc, excluded, cache, signature)
2129
2130 if signature is not None:
-> 2131 self._in_and_out_core_dims = _parse_gufunc_signature(signature)
2132 else:
2133 self._in_and_out_core_dims = None
~/mambaforge/envs/py/lib/python3.9/site-packages/numpy/lib/function_base.py in _parse_gufunc_signature(signature)
1865 """
1866 if not re.match(_SIGNATURE, signature):
-> 1867 raise ValueError(
1868 'not a valid gufunc signature: {}'.format(signature))
1869 return tuple([tuple(re.findall(_DIMENSION_NAME, arg))
ValueError: not a valid gufunc signature: (n, n)->(n, n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment