• khaotik's avatar
    better handling for NullType and DisconnectedType · 8e8758a3
    khaotik 提交于
    major changes:
    
    - The self._grad_op now only returns zeros_like() for special types like
        NullType() or DisconnectedType()
    - call to grad() will furthur replace returned zero tensors with special
        types
    - proposed gradient override interface :
        (single or list of below)
        Ellipsis -> <no_override>
            (-) since python 2 does not support `[...]` syntax, this may
            result in uglier code in python 2
        None -> NullType()
        int(0) -> DisconnectedType()
        OpFromGraph instance or callable -> <override>
    
    minor changes:
    
    - various typo/bug fix
    
    notes:
    
    - This commit breaks OpFromGraph.R_op, which is expected to be fixed in
    upcoming commits.
    8e8758a3
test_builders.py 10.1 KB