This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
Closed
Description
我们在 #157 实现了 Builtin 函数的派发机制,并在 #182 将大多数现有的魔法函数自动派发派发机制替换成了我们自己的 Dispatch 机制,但仍然存留部分在 Variable 上的魔法函数,为了能够更好地复用代码,我们计划将这些部分也替换成 Builtin Dispatch 实现,这主要包含:
operator.getitem
->VariableBase/TensorVariable/ListVariable/TupleVariable/DictVariable.__getitem__
operator.setitem
->VariableBase/TensorVariable/ListVariable/TupleVariable/DictVariable.__setitem__
operator.delitem
->ListVariable/TupleVariable/DictVariable.__delitem__
bool
->ConstantVariable.__bool__
(不要直接删掉,参考 add a basic BuiltinVariable dispatch mechanism #157 对 ContainerVariable 的修改)
目前应该就这些,__call__
是不需要转发的
具体实现可参考第一个实现 PR #157 和机制替换 PR #182,以及设计文档 https://github.com/PaddlePaddle/PaddleSOT/blob/develop/docs/design/builtin-dispatcher.md