python中tf.abs_python – Tensorflow:替换tf.nn.rnn_cell._linear(输入,大小,0,范围)

我试图从

https://arxiv.org/pdf/1609.05473.pdf开始运行SequenceGAN(

https://github.com/LantaoYu/SeqGAN).

修复明显的错误后,比如用堆栈替换pack,它仍然无法运行,因为高速公路网络部分需要tf.nn.rnn_cell._linear函数:

# highway layer that borrowed from https://github.com/carpedm20/lstm-char-cnn-tensorflow

def highway(input_, size, layer_size=1, bias=-2, f=tf.nn.relu):

"""Highway Network (cf. http://arxiv.org/abs/1505.00387).

t = sigmoid(Wy + b)

z = t * g(Wy + b) + (1 - t) * y

where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.

"""

output = input_

for idx in range(layer_size):

output = f(tf.nn.rnn_cell._linear(output, size, 0, scope='output_lin_%d' % idx)) #tf.contrib.layers.linear instad doesn't work either.

transform_gate = tf.sigmoid(tf.nn.rnn_cell._linear(input_, size, 0, scope='transform_lin_%d' % idx) + bias)

carry_gate = 1. - transform_gate

output = transform_gate * output + carry_gate * input_

return output

在Tensorflow 1.0或0.12中,tf.nn.rnn_cell._linear函数似乎不再存在,我不知道要用什么替换它.我找不到任何新的实现,或者有关tensorflow的github或(遗憾的是非常稀疏的)文档的任何信息.

有人知道这个功能的新吊坠吗?

非常感谢提前!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值