szha commented on a change in pull request #19685:
URL: https://github.com/apache/incubator-mxnet/pull/19685#discussion_r577027310
##########
File path: python/mxnet/_ctypes/cached_op.py
##########
@@ -74,27 +74,32 @@ def __call__(self, *args, **kwargs):
"""ctypes implementation of imperative invoke wrapper"""
# New FFI only supports numpy ndarray
default_ctx = kwargs.pop('default_ctx', None)
+ out = kwargs.pop('out', None)
+ if kwargs:
+ raise TypeError(
+ "CachedOp.__call__ got unexpected keyword argument(s): " + \
+ ', '.join(kwargs.keys()))
if self.is_np_sym:
if len(args) == 1 and args[0] is None:
args = []
type_id = default_ctx.device_typeid if default_ctx else None
device_id = default_ctx.device_id if default_ctx else None
+ out_arg = out if out and not isinstance(out, NDArrayBase) else
(out, )
Review comment:
if the intention is to check whether `out` is not None, it's probably
better to write it that way. Otherwise, `if NDArray` will call `__bool__` of
NDArray
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]