源自github用户reyoung:
Based on PR #3546:Adapting to the BatchNorm structure to support 3D data
Commit is 6d6180d
补充一些没来得及实现的想法:
struct Model {
Network init_net;
Stack<Network> nets;
Stack<Scope> scopes;
Network* cur_net = nets.top();
Scope* cur_scope = scopes.top();
Set<string> all_param_names;
int name_counter{0};
Place place {None};
DeviceContext dev_ctx {None};
};
出栈入栈(RNN/IF):
即RNN和IF中的每一个block都是一个函数,在开始调用函数和结束调用函数的时候,进行出栈入栈。
def recurrent(callback):
rnn = cur_net.add_op("recurrent");
nets.push(rnn.step_net)
cur_net = nets.top()
# same thing for scope.
callback()
nets.pop()
cur_net = nets.top()
def step_net():
fc(...)
return fc(...)
rnn = recurrent(step_net)
子图:
获取子图只能从根网络(即最初的网络)进行。子图获得可以简单的维护一个需要依赖的Variable的名字集合,然后反向遍历Net中的Op。当一个Op的输出的任意一个在名字集合中,将这个Op加入新的子图,同时将这个Op的所有输入加到名字集合中。
源自github用户luotao1:
感谢您给PaddlePaddle贡献代码。由于Paddle V1/V2版本已不再维护,相关代码也已从develop分支上删除,因此关闭您的PR,欢迎您向Paddle最新版-Fluid贡献代码。
Thanks for contributing to PaddlePaddle! Since V1/V2 will not be maintained anymore, and related codes have been deleted from develop branch as well, we close this PR. Welcome to contribute to Fluid——the latest version of PaddlePaddle.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论