def infer()

in source/python/neuropod/loader.py [0:0]


    def infer(self, inputs):
        """
        Run inference using the specifed inputs.

        :param  inputs:     A dict mapping input names to values. This must match the input
                            spec in the neuropod config for the loaded model.
                            Ex: {'x1': np.array([5]), 'x2': np.array([6])}
                            *Note:* all the keys in this dict must be strings and all the
                            values must be numpy arrays

        :returns:   A dict mapping output names to values. This is checked to ensure that it
                    matches the spec in the neuropod config for the loaded model. All the keys
                    in this dict are strings and all the values are numpy arrays.
        """
        # Convert unicode to bytes before running inference
        for key, value in inputs.items():
            if value.dtype.type == np.unicode_:
                inputs[key] = np.char.encode(value, encoding="UTF-8")

        out = self.model.infer(inputs)

        # Convert bytes to unicode
        for key, value in out.items():
            if value.dtype.type == np.bytes_:
                out[key] = np.char.decode(value, encoding="UTF-8")

        return out