Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use InputLayer/ How to interact TensorFlow and TensorLayer #7

Closed
llan-ml opened this issue Sep 29, 2016 · 3 comments
Closed

Comments

@llan-ml
Copy link

llan-ml commented Sep 29, 2016

The input of each layer (e.g., Dense layer and Conv layer) except "Input layer" must be a Layer instance.
I think this behavior is not so transparent to TensorFlow.

In the case that I want to use an intermediate tf.Tensor as input for a Layer instance,
is there any existing method of TensorLayer to implement this function?

@zsdonghao
Copy link
Member

Hi, you can feed your tf.Tensor into tl.layers.InputLayer and then feed the layer into Dense and Conv layer.

If you look into the source code, the InputLayer just creat a Layer.outputs , more details can be found on the documentation : http://tensorlayer.readthedocs.io/en/latest/modules/layers.html#understand-layer

@llan-ml
Copy link
Author

llan-ml commented Sep 29, 2016

@zsdonghao thx, the solution is the same as mine.
But this solution causes that newly created layers cannot track components,which are located before tl.layers.InputLayer, using methods such as layer.all_params and layer.all_drop.

@zsdonghao
Copy link
Member

@llan-ml Yes, indeed. Layer cannot track the parameters outside TensorLayer, I suggest you to usetrain_params = layer.all_params + [you parameters] if you want to update the parameters outside TensorLayer .

For layers.all_drop, if you control the keep probabilities by placeholder, then you will need to feed the values into feed_dict, but in this case, to keep everything simple, I suggest you to create different graph for training and evaluating :
e.g. https://github.com/zsdonghao/tensorlayer/blob/master/tutorial_ptb_lstm_state_is_tuple.py

@llan-ml llan-ml closed this as completed Sep 29, 2016
@zsdonghao zsdonghao changed the title input of Layers How to use InputLayer/ How to interact TensorFlow and TensorLayer Dec 27, 2016
zsdonghao added a commit that referenced this issue May 4, 2019
Jingqing patch: requirement fixed and tutorial folder reorganised
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants