我已将server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
location / {
# proxy pass to your app
proxy_pass http://localhost:7070;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
子类化为我的RNN的构建块。我将此对象的实例放入RNNCell
,然后在tf.dynamic_rnn
类中定义预测函数:
Agent
一切正常,但我现在如何为图层添加直方图?我试图在class Agent():
def __init__(self):
...
def predictions(self):
cell = RNNCell()
output, last_state = tf.dynamic_rnn(cell, inputs = ...)
return output
中进行此操作,但它不起作用:
RNNCell
然后
class RNNCell(tf.nn.rnn_cell.RNNCell):
def __init__(self):
super(RNNCell, self).__init__()
self._output_size = 15
self._state_size = 15
self._histogram1 = None
def __call__(self, X, state):
network = tflearn.layers.conv_2d(X, 5, [1, 3], activation='relu', weights_init=tflearn.initializations.variance_scaling(), padding="valid")
self._histogram1 = tf.summary.histogram("layer1_hist_summary", network)
...
@property
def histogram1(self):
return self._histogram1
稍后当我运行class Agent():
def __init__(self):
...
def predictions(self):
cell = RNNCell()
self.histogram1 = cell.histogram1
output, last_state = tf.dynamic_rnn(cell, inputs = ...)
return output
时,我收到错误sess.run(agent.histogram1, feed_dict=...)
答案 0 :(得分:0)
我认为问题是Agent的self.histogram1的价值从未更新,以反映RNNCell中分配的摘要。
您的Agent predictions()方法的代码在此处将Agent的histogram1值初始化为None:
cell = RNNCell() #invoks __init__() so RNNCELL's histogram1 is now None
self.histogram1 = cell.histogram1
当调用RNNCell的__call__()
方法时,它会更新RNNCell的histogram1值
self._histogram1 = tf.summary.histogram("layer1_hist_summary", network)
但是代理商的histogram1副本显然没有更新,所以当打电话时:
sess.run(agent.histogram1, feed_dict=...)
agent.histogram1仍然是无。
我没有在发布的代码中看到摘要在培训之前合并的情况,因此缺少的步骤很可能是在某处未发布的代码中。