0

我正在尝试在千层面中找到索引 2d max pooling

network = batch_norm(Conv2DLayer(
        network, num_filters=filter_size, filter_size=(kernel, kernel),pad=pad,
        nonlinearity=lasagne.nonlinearities.rectify, 
        W=lasagne.init.GlorotUniform(),name="conv"), name="BN")
pool_in = lasagne.layers.get_output(network)
network = MaxPool2DLayer(network, pool_size=(pool_size, pool_size),stride=2,name="pool")
pool_out = lasagne.layers.get_output(network)
ind1 = T.grad(T.sum(pool_out), wrt=pool_in)

当我尝试构建模型时,它会引发错误

DisconnectedInputError: grad method was asked to compute the gradient with respect to a variable that is not part of the computational graph of the cost, or is used only by a non-differentiable operator: Elemwise{mul,no_inplace}.0
Backtrace when the node is created:
  File "//anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2871, in run_cell
    interactivity=interactivity, compiler=compiler, result=result)
  File "//anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 2975, in run_ast_nodes
    if self.run_code(code, result):
  File "//anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3035, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-28-0b136cc660e2>", line 1, in <module>
    network = build_model()
  File "<ipython-input-27-20acc3fe0d98>", line 8, in build_model
    pool_in = lasagne.layers.get_output(network)
  File "//anaconda/lib/python2.7/site-packages/lasagne/layers/helper.py", line 191, in get_output
    all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs)
  File "//anaconda/lib/python2.7/site-packages/lasagne/layers/special.py", line 52, in get_output_for
    return self.nonlinearity(input)
  File "//anaconda/lib/python2.7/site-packages/lasagne/nonlinearities.py", line 157, in rectify
    return theano.tensor.nnet.relu(x)

在千层面层中间输出上编码函数的正确方法是什么。

4

1 回答 1

0

不久前我遇到了类似的问题,请查看我的 2d 和 3d 最大池化索引解决方案:

Theano max_pool_3d

(我猜它基于相同的 Google-groups 帖子)

于 2016-03-01T10:38:28.790 回答