You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The dtype constraints decorator doesn't currently work for overloaded functions since it stores the functions by name in the TYPE_VERIFICATION map.
We can make the following changes to make it work for overloaded functions:
Update the docstring directly in the decorator instead of in conf.py. If we do it in conf.py, we need to be able to look up the overloaded functions in the TYPE_VERIFICATION map which will require us to disambiguate them somehow. Note that a naive approach of using the function object as the key doesn't work because decorating a function with other decorators will change the function object - basically, the object seen at the point where the constraints decorator is applied might not be the same one seen during documentation generation (e.g. if there are any further decorators applied at that point).
Update TYPE_VERIFICATION to some type of multimap so that we can generate the tests correctly.
Finally, if we need to access type verification information for other reasons (e.g. to determine which dtypes to use when automatically converting inputs to tensors), we could attach it directly to the function object. We will then need some logic to recurse through the various layers of .__wrapped__ functions to find the dtype information.
The text was updated successfully, but these errors were encountered:
The dtype constraints decorator doesn't currently work for overloaded functions since it stores the functions by name in the
TYPE_VERIFICATION
map.We can make the following changes to make it work for overloaded functions:
conf.py
. If we do it inconf.py
, we need to be able to look up the overloaded functions in theTYPE_VERIFICATION
map which will require us to disambiguate them somehow. Note that a naive approach of using the function object as the key doesn't work because decorating a function with other decorators will change the function object - basically, the object seen at the point where the constraints decorator is applied might not be the same one seen during documentation generation (e.g. if there are any further decorators applied at that point).TYPE_VERIFICATION
to some type of multimap so that we can generate the tests correctly..__wrapped__
functions to find the dtype information.The text was updated successfully, but these errors were encountered: