• Xavier Bouthillier's avatar
    replace `from .nnet import *` · 28c56939
    Xavier Bouthillier 提交于
    ```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, ...)
    ```
    28c56939
__init__.py 1.6 KB