oneflow icon indicating copy to clipboard operation
oneflow copied to clipboard

Add Args.CartesianProduct and some minor changes

Open daquexian opened this issue 5 years ago • 3 comments

按照 @Dounm 的建议加了一个静态方法 Args.CartesianProduct,返回一个 List[Args],用法是

# 相当于 arg_dict['op_args'] = [Args([0,3]), Args([0, 4]), Args([1, 3]), Args([1, 4])]
arg_dict['op_args'] = Args.CartesianProduct[[0, 1], [3,4]]

并顺便加上了一个 pad test 里位置错了的括号、支持 OrderList 作为 Args 的参数

daquexian avatar Apr 16 '20 04:04 daquexian

还有

  1. 改完之后改一下 test_matmul.py并测试一下
  2. 我没明白为什么不能把input作为外界输入,在解释一下吧

Dounm avatar Apr 16 '20 09:04 Dounm

我没明白为什么不能把input作为外界输入,在解释一下吧

在 RunOneflowOp 和 RunTensorFlowOp 里需要把 input 的梯度求出来,但其它参数(例如 pad op 的 pad 长度)就不需要求梯度,所以 input 和其他参数不是被同等对待的。如果让 input 从外界输入,就要再传一个信息,告诉这两个函数哪些参数是 input,用户使用这个接口的复杂度没有降低很多,但实现起来复杂度更高了

daquexian avatar Apr 16 '20 09:04 daquexian

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
4 out of 5 committers have signed the CLA.

:white_check_mark: lixinqi
:white_check_mark: leaves-zwx
:white_check_mark: ScXfjiang
:white_check_mark: shangguanshiyuan
:x: JamiePlur
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 29 '21 09:04 CLAassistant