Skip to content

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented Aug 18, 2017

Based on PR #3546
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的所有输入加到名字集合中。

@luotao1
Copy link
Contributor

luotao1 commented Feb 1, 2019

感谢您给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.

@luotao1 luotao1 closed this Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants