博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Tied weights in Tensorflow
阅读量:4080 次
发布时间:2019-05-25

本文共 986 字,大约阅读时间需要 3 分钟。

I have been thinking for several days about this problems.

As before, if I initialized one weight for the encoder part, and then transpose it for the decoder part. whethere it would be the tied weights?
Today, I did a experiments, and saw that it was true. See the code below:

x = tf.placeholder(dtype=tf.float32, shape=[None, 4])w = tf.Variable(tf.truncated_normal(shape=[4, 2], mean=0.0, stddev=0.1, dtype=tf.float32))b = tf.Variable(tf.constant(0.0, shape=[2], dtype=tf.float32))z = tf.nn.relu(tf.matmul(x, w) + b)w_inv = tf.transpose(w)b_inv = tf.Variable(tf.constant(0.0, shape=[4], dtype=tf.float32))rec = tf.nn.relu(tf.matmul(z, w_inv) + b_inv)loss = tf.squared_difference(x, rec)train_op = tf.train.AdamOptimizer().minimize(loss)with tf.Session() as sess:    sess.run(tf.global_variables_initializer())    all_variables = tf.trainable_variables()    for v in all_variables:        print(v)

And the outputs:

It is clearly, here the tied weights are successful.

转载地址:http://zlini.baihongyu.com/

你可能感兴趣的文章
从超链接调用ActionScript
查看>>
谈谈加密和混淆吧[转]
查看>>
TCP的几个状态对于我们分析所起的作用SYN, FIN, ACK, PSH,
查看>>
网络游戏客户端的日志输出
查看>>
关于按钮的mouseOver和rollOver
查看>>
《多线程服务器的适用场合》例释与答疑
查看>>
Netty框架
查看>>
Socket经验记录
查看>>
对RTMP视频流进行BitmapData.draw()出错的解决办法
查看>>
FMS 客户端带宽计算、带宽限制
查看>>
在线视频聊天(客服)系统开发那点事儿
查看>>
SecurityError Error 2148 SWF 不能访问本地资源
查看>>
Flex4的可视化显示对象
查看>>
Flex:自定义滚动条样式/隐藏上下箭头
查看>>
烈焰SWF解密
查看>>
Qt 静态编译后的exe太大, 可以这样压缩.
查看>>
3D游戏常用技巧Normal Mapping (法线贴图)原理解析——基础篇
查看>>
乘法逆元
查看>>
STL源码分析----神奇的 list 的 sort 算法实现
查看>>
Linux下用math.h头文件
查看>>