Beispiel #1
0
    def predict(self):
        """
        AUTHORS:
        --------

        :author: Samuel Westlake
        :author: Alix Leroy

        DESCRIPTION:
        ------------

        Inference of the model

        PARAMETERS:
        -----------

        None

        RETURN:
        -------

        :return outputs->dict: the total losses and total metrics for the model over the test data set
        """
        # Initialise an empty tensor to store outputs
        outputs = Tensor()
        for minibatch_index, minibatch in enumerate(self.dataloader, 0):
            inputs, labels, additional_data = self.clean_single_element_list(minibatch)
            # Infer the outputs from the model over the given mini batch
            minibatch_output = self.model(*inputs)
            # Append mini_batch output to the output tensor
            outputs.cat(minibatch_output.detach())
        return outputs