# Buggy code
def execute(cls, ctx, op):
    func_name = getattr(cls, "_func_name")
    inputs, device_id, xp = as_same_device(
        [ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
    )

    func = getattr(xp, func_name)

    with device(device_id):
        kw = {"casting": op.casting} if op.out else {}

        inputs_iter = iter(inputs)
        lhs = op.lhs if np.isscalar(op.lhs) else next(inputs_iter)
        rhs = op.rhs if np.isscalar(op.rhs) else next(inputs_iter)
        if op.out:
            kw["out"] = next(inputs_iter).copy()
        if op.where:
            kw["where"] = next(inputs_iter)
        kw["order"] = op.order

        with np.errstate(**op.err):
            ctx[op.outputs[0].key] = _handle_out_dtype(func(lhs, rhs, **kw), op.dtype)


# Traceback (TypeError)
In [13]: x = mt.random.rand(10, 10, gpu=True)

In [14]: (x + 1).execute()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-14-60cf72259190> in <module>
----> 1 (x + 1).execute()

~/mars/mars/tensor/core.py in execute(self, session, **kw)
450
451     def execute(self, session=None, **kw):
--> 452         return self._data.execute(session, **kw)
453
454

~/mars/mars/core.py in execute(self, session, **kw)
582         if session is None:
583             session = Session.default_or_local()
--> 584         return session.run(self, **kw)
585
586     def fetch(self, session=None, **kw):

~/mars/mars/session.py in run(self, *tileables, **kw)
150         tileables = tuple(mt.tensor(t) if not isinstance(t, (Entity, Base)) else t
151                           for t in tileables)
--> 152         result = self._sess.run(*tileables, **kw)
153
154         for t in tileables:

~/mars/mars/session.py in run(self, *tileables, **kw)
61         if 'n_parallel' not in kw:
62             kw['n_parallel'] = cpu_count()
---> 63         res = self._executor.execute_tileables(tileables, **kw)
64         return res
65

~/mars/mars/utils.py in _wrapped(*args, **kwargs)
393                 _kernel_mode.eager = False
394             _kernel_mode.eager_count = enter_eager_count + 1
--> 395             return func(*args, **kwargs)
396         finally:
397             _kernel_mode.eager_count -= 1

~/mars/mars/executor.py in execute_tileables(self, tileables, fetch, n_parallel, n_thread, print_progress, mock, compose)
562         self.execute_graph(graph, result_keys, n_parallel=n_parallel or n_thread,
563                            print_progress=print_progress, mock=mock,
--> 564                            chunk_result=chunk_result)
565
566         self._chunk_result.update(chunk_result)

~/mars/mars/executor.py in execute_graph(self, graph, keys, n_parallel, print_progress, mock, no_intermediate, compose, retval, chunk_result)
494                                          mock_max_memory=self._mock_max_memory,
495                                          fetch_keys=fetch_keys, no_intermediate=no_intermediate)
--> 496         res = graph_execution.execute(retval)
497         self._mock_max_memory = max(self._mock_max_memory, graph_execution._mock_max_memory)
498         if mock:

~/mars/mars/executor.py in execute(self, retval)
387         # wait until all the futures completed
388         for future in executed_futures:
--> 389             future.result()
390
391         if retval:

~/miniconda3/lib/python3.7/concurrent/futures/_base.py in result(self, timeout)
423                 raise CancelledError()
424             elif self._state == FINISHED:
--> 425                 return self.__get_result()
426
427             self._condition.wait(timeout)

~/miniconda3/lib/python3.7/concurrent/futures/_base.py in __get_result(self)
382     def __get_result(self):
383         if self._exception:
--> 384             raise self._exception
385         else:
386             return self._result

~/miniconda3/lib/python3.7/concurrent/futures/thread.py in run(self)
55
56         try:
---> 57             result = self.fn(*self.args, **self.kwargs)
58         except BaseException as exc:
59             self.future.set_exception(exc)

~/mars/mars/executor.py in _execute_operand(self, op)
265             # so we pass the first operand's first output to Executor.handle
266             first_op = ops[0]
--> 267             Executor.handle(first_op, results, self._mock)
268
269             # update maximal memory usage during execution

~/mars/mars/executor.py in handle(cls, op, results, mock)
450             runner = getattr(op, method_name)
451         try:
--> 452             return runner(results, op)
453         except NotImplementedError:
454             for op_cls in mapper.keys():

~/mars/mars/tensor/arithmetic/core.py in execute(cls, ctx, op)
112
113             with np.errstate(**op.err):
--> 114                 ctx[op.outputs[0].key] = _handle_out_dtype(func(lhs, rhs, **kw), op.dtype)
115
116

cupy/core/_kernel.pyx in cupy.core._kernel.ufunc.__call__()

TypeError: Wrong arguments {'order': 'K'}

# Fixed code
def execute(cls, ctx, op):
    inputs, device_id, xp = as_same_device(
        [ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
    )

    with device(device_id):
        kw = {"casting": op.casting} if op.out else {}

        inputs_iter = iter(inputs)
        lhs = op.lhs if np.isscalar(op.lhs) else next(inputs_iter)
        rhs = op.rhs if np.isscalar(op.rhs) else next(inputs_iter)
        if op.out:
            kw["out"] = next(inputs_iter).copy()
        if op.where:
            kw["where"] = next(inputs_iter)

        with np.errstate(**op.err):
            if op.is_gpu():
                ret = cls._execute_gpu(op, xp, lhs, rhs, **kw)
            else:
                ret = cls._execute_cpu(op, xp, lhs, rhs, **kw)
            ctx[op.outputs[0].key] = _handle_out_dtype(ret, op.dtype)