deepy/core/loop.py
def _scan_step(self, vars):
        """
        Internal scan with dummy input variables.
        """
        from neural_var import NeuralVariable
        if not self._loop_vars:
            raise Exception("The loop is not initialized. To initialize the loop, use `with loop as vars`")
        replace_map = {}
        for k, var in vars.items():
            if var is not None:
                replace_map[self._dummy_nodes[k].tensor] = var.tensor
        outputs = {}
        for k in self._outputs:
            if k not in self._loop_vars:
                raise Exception("{} can not be found in loop vars.".format(k))
            output_node = theano.clone(self._loop_vars[k].tensor, replace_map)
            outputs[k] = NeuralVariable(output_node, self._loop_vars[k].dim())
        return outputs
def _scan_step(self, vars):
        from neural_var import NeuralVariable
        if not self._loop_vars:
            raise Exception("The loop is not initialized. To initialize the loop, use `with loop as vars`")
        replace_map = {}
        for k, var in vars.items():
            if var is not None:
                replace_map[self._dummy_nodes[k].tensor] = var.tensor
        outputs = {}
        for k in self._outputs:
            if k not in self._loop_vars:
                raise Exception("{} can not be found in loop vars.".format(k))
            output_node = theano.clone(self._loop_vars[k].tensor, replace_map)
            outputs[k] = NeuralVariable(output_node, self._loop_vars[k].dim())
        return outputs
def _scan_step ( self , vars ) : from neural_var import NeuralVariable if not self . _loop_vars : raise Exception ( "The loop is not initialized. To initialize the loop, use `with loop as vars`" ) replace_map = { } for k , var in vars . items ( ) : if var is not None : replace_map [ self . _dummy_nodes [ k ] . tensor ] = var . tensor outputs = { } for k in self . _outputs : if k not in self . _loop_vars : raise Exception ( "{} can not be found in loop vars." . format ( k ) ) output_node = theano . clone ( self . _loop_vars [ k ] . tensor , replace_map ) outputs [ k ] = NeuralVariable ( output_node , self . _loop_vars [ k ] . dim ( ) ) return outputs
Internal scan with dummy input variables.
Internal scan with dummy input variables .