提交 28c56939 authored 作者: Xavier Bouthillier's avatar Xavier Bouthillier 提交者: AdeB

replace `from .nnet import *`

```from .nnet import *``` in ```theano/tensor/nnet/__init__.py``` is causing problems because ```nnet``` imports ```theano.tensor.opt``` as ```opt``` which takes namespace place of ```theano.tensor.nnet.opt```. To fix this problem, I replace ```from .nnet import *``` by ```from .nnet import (every class/functions/attributes)``` Added the following code at the end of the file ```theano/tensor/nnet/nnet.py``` ```python print locals().keys() ``` And then copied the output ```bash $ python theano/tensor/nnet/nnet.py ['keys', 'of', 'locals', ...] ``` Removed last line of code in ```theano/tensor/nnet/nnet.py``` and added following code under the imports ```python keys = ['keys', 'of', 'locals', ...] # pasted the copied output from previous step local_keys = locals().keys() keep = filter(lambda a: a not in local_keys and a[0] != '_', keys) print sorted(keep) ``` And again ```bash $ python theano/tensor/nnet/nnet.py ['keys', 'of', 'locals', 'minus', 'imports', 'and', 'private'...] ``` Those are the class/function names to be added to ```theano/tensor/nnet/__init__.py```. ```python from .nnet import ( keys, of, locals, minus, imports, and, private, ...) ```
上级 8037a997
from .nnet import *
from .nnet import (
CrossentropyCategorical1Hot, CrossentropyCategorical1HotGrad,
CrossentropySoftmax1HotWithBiasDx, CrossentropySoftmaxArgmax1HotWithBias,
Prepend_scalar_constant_to_each_row, Prepend_scalar_to_each_row, Softmax,
SoftmaxGrad, SoftmaxWithBias, binary_crossentropy,
categorical_crossentropy, crossentropy_categorical_1hot,
crossentropy_categorical_1hot_grad, crossentropy_softmax_1hot,
crossentropy_softmax_1hot_with_bias,
crossentropy_softmax_1hot_with_bias_dx,
crossentropy_softmax_argmax_1hot_with_bias,
crossentropy_softmax_max_and_argmax_1hot,
crossentropy_softmax_max_and_argmax_1hot_with_bias,
crossentropy_to_crossentropy_with_softmax,
crossentropy_to_crossentropy_with_softmax_with_bias,
graph_merge_softmax_with_crossentropy_softmax, h_softmax,
local_advanced_indexing_crossentropy_onehot,
local_advanced_indexing_crossentropy_onehot_grad, local_argmax_pushdown,
local_log_softmax, local_softmax_grad_to_crossentropy_with_softmax_grad,
local_softmax_with_bias,
local_useless_crossentropy_softmax_1hot_with_bias_dx_alloc,
make_out_pattern, prepend_0_to_each_row, prepend_1_to_each_row,
prepend_scalar_to_each_row, relu, softmax, softmax_grad, softmax_graph,
softmax_op, softmax_simplifier, softmax_with_bias)
from . import opt
from .conv import conv2d, ConvOp
from .Conv3D import *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论