deepy/layers/layer.py
def compute(self, *inputs, **kwargs):
        """
        Compute based on NeuralVariable.
        :type inputs:  list of NeuralVariable
        :return: NeuralVariable
        """
        from deepy.core.neural_var import NeuralVariable
        from deepy.core.graph import graph
        if type(inputs[0]) != NeuralVariable:
            raise SystemError("The input of `compute` must be NeuralVar")

        dims = [t.dim() for t in inputs]
        if len(inputs) == 1:
            self.init(input_dim=dims[0])
        else:
            self.init(input_dims=dims)
        # Check block
        if self.parameters and not self._linked_block:
            self.belongs_to(graph.default_block())
        # convert kwargs
        train_kwargs, _, _ = convert_to_theano_var(kwargs)

        output = self.compute_tensor(*[t.tensor for t in inputs], **train_kwargs)

        if type(output) != list and type(output) != tuple:
            return NeuralVariable(output, dim=self.output_dim)
        else:
            return [NeuralVariable(*item) for item in zip(output, self.output_dims)]
def compute(self, *inputs, **kwargs):
        """
        Compute based on NeuralVariable.
        :type inputs:  list of NeuralVariable
        :return: NeuralVariable
        """
        from deepy.core.neural_var import NeuralVariable
        from deepy.core.graph import graph
        if type(inputs[0]) != NeuralVariable:
            raise SystemError("The input of `compute` must be NeuralVar")

        dims = [t.dim() for t in inputs]
        if len(inputs) == 1:
            self.init(input_dim=dims[0])
        else:
            self.init(input_dims=dims)
        # Check block
        if self.parameters and not self._linked_block:
            self.belongs_to(graph.default_block())
        # convert kwargs
        train_kwargs, _, _ = convert_to_theano_var(kwargs)

        output = self.compute_tensor(*[t.tensor for t in inputs], **train_kwargs)

        if type(output) != list and type(output) != tuple:
            return NeuralVariable(output, dim=self.output_dim)
        else:
            return [NeuralVariable(*item) for item in zip(output, self.output_dims)]
def compute ( self , * inputs , * * kwargs ) : from deepy . core . neural_var import NeuralVariable from deepy . core . graph import graph if type ( inputs [ 0 ] ) != NeuralVariable : raise SystemError ( "The input of `compute` must be NeuralVar" ) dims = [ t . dim ( ) for t in inputs ] if len ( inputs ) == 1 : self . init ( input_dim = dims [ 0 ] ) else : self . init ( input_dims = dims ) # Check block if self . parameters and not self . _linked_block : self . belongs_to ( graph . default_block ( ) ) # convert kwargs train_kwargs , _ , _ = convert_to_theano_var ( kwargs ) output = self . compute_tensor ( * [ t . tensor for t in inputs ] , * * train_kwargs ) if type ( output ) != list and type ( output ) != tuple : return NeuralVariable ( output , dim = self . output_dim ) else : return [ NeuralVariable ( * item ) for item in zip ( output , self . output_dims ) ]
Compute based on NeuralVariable.
        :type inputs:  list of NeuralVariable
        :return: NeuralVariable
Compute based on NeuralVariable . : type inputs : list of NeuralVariable : return : NeuralVariable