(self, batch)
return out
Prepare the batch and feed it to the network, criterion and metric.

            Returns:
                out (dict): a dictionary of outputs
Prepare the batch and feed it to the network, criterion and metric.
Prepare the batch and feed it to the network criterion and metric .
def forward(self, batch):
        """ Prepare the batch and feed it to the network, criterion and metric.

            Returns:
                out (dict): a dictionary of outputs
        """
        batch = self.prepare_batch(batch)
        net_out = self.network(batch)

        cri_out = {}
        if self.mode in self.criterions:
            cri_tmp = self.criterions[self.mode](net_out, batch)
            if cri_tmp is not None:
                cri_out = cri_tmp

        met_out = {}
        if self.mode in self.metrics:
            met_tmp = self.metrics[self.mode](cri_out, net_out, batch)
            if met_tmp is not None:
                met_out = met_tmp

        out = {}
        if type(net_out) is dict:
            for key, value in net_out.items():
                out[key] = value
        if type(cri_out) is dict:
            for key, value in cri_out.items():
                out[key] = value
        if type(met_out) is dict:
            for key, value in met_out.items():
                out[key] = value
        return out
def forward ( self , batch ) : batch = self . prepare_batch ( batch ) net_out = self . network ( batch ) cri_out = { } if self . mode in self . criterions : cri_tmp = self . criterions [ self . mode ] ( net_out , batch ) if cri_tmp is not None : cri_out = cri_tmp met_out = { } if self . mode in self . metrics : met_tmp = self . metrics [ self . mode ] ( cri_out , net_out , batch ) if met_tmp is not None : met_out = met_tmp out = { } if type ( net_out ) is dict : for key , value in net_out . items ( ) : out [ key ] = value if type ( cri_out ) is dict : for key , value in cri_out . items ( ) : out [ key ] = value if type ( met_out ) is dict : for key , value in met_out . items ( ) : out [ key ] = value return out