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, ...)
```
正在显示
请
注册
或者
登录
后发表评论