Comments (4)
@JindongJiang Good idea, indeed.
I think we can create 2 functions for Layer
class : network.get_layers_by_name("conv2")
and network.get_params_by_name("W")
.
network.get_params_by_name("W")
should be similar with tl.layer. get_variables_with_name()
as follow:
def get_variables_with_name(name, train_only=True, printable=False):
"""Get variable list by a given name scope.
Examples
---------
>>> dense_vars = get_variable_with_name('dense', True, True)
"""
print(" Get variables with %s" % name)
t_vars = tf.trainable_variables() if train_only else tf.all_variables()
d_vars = [var for var in t_vars if name in var.name]
if printable:
for idx, v in enumerate(d_vars):
print(" got {:3}: {:15} {}".format(idx, v.name, str(v.get_shape())))
return d_vars
You can try this code by adding it to Layer
:
def get_params_by_name(self, name, printable=False):
print(" Get params in a network with %s" % name)
t_vars = self.all_params
d_vars = [var for var in t_vars if name in var.name]
if printable:
for idx, v in enumerate(d_vars):
print(" got {:3}: {:15} {}".format(idx, v.name, str(v.get_shape())))
return d_vars
from tensorlayer.
@zsdonghao Thx. And w.r.t network.get_layers_by_name maybe :
self.all_layers = layer.all_layers
...
self.all_layers[name] = self.output
and:
def get_layers_by_name(self, name):
print(" Get layers in a network with %s" % name)
d_layers = self.all_layers.get(name, None)
if d_layers is None:
print(" %s not implemented ".format(name))
return d_layers
Could work ?
from tensorlayer.
I think it should work, but it that possible don't add new code into every layers?
from tensorlayer.
@JindongJiang tl.layers.get_layers_with_name is now in the master version
from tensorlayer.
Related Issues (20)
- Possible Arbitrary code execution bug. HOT 5
- examples/reinforcement_learning/tutorial_A3C.py Training failure to converge HOT 1
- SRGAN转为.pb HOT 2
- tl.layers.DropoutLayer 用于构建tf.estimator.Estimator,训练/预测模式切换时 报错 ‘ValueError: Variable model/relu1/W does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?’ HOT 2
- Question about the implementation of the 'Jaccard' Dice coefficient HOT 2
- Performance issues in examples/ HOT 3
- Performance issue in the definition of read_and_decode, examples/data_process/tutorial_tfrecord.py(P1) HOT 2
- Problem with the 2nd order derivative using TL activations
- module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' , This error is reported after the program runs HOT 5
- How is the loss calculated about actor in A3C
- Questions about PPO HOT 1
- AttributeError: module 'tensorflow.python.framework.ops' has no attribute '_TensorLike' HOT 2
- AttributeError: 'str' object has no attribute 'decode' HOT 6
- IndexError: list index out of range
- Grammatical error HOT 1
- A problem about using cuda() HOT 2
- module 'tensorflow' has no attribute 'placeholder' HOT 1
- 如何使用贝尔曼期望方程计算价值函数 V (s)?
- 'tensorflow.python.framework.ops.EagerTensor' object has no attribute '_info' HOT 1
- There are errors in the source code(源代码写的有错误)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tensorlayer.