def __getstate__(self):
        """
        Extract serializable state from an instance
        """
        forward_func = self.op._func
        inv_data_func = self.inversion_data._func
        backward_func = self.inverse._func
        network_params = self.op.network.state_dict()
        weights = dict(
            ((k, v.cpu().numpy()) for k, v in network_params.items()))
        cls = self.op.network.__class__
        name = self.name
        init_args = extract_init_args(self.op.network)

        kwargs = dict(self.op.kwargs)
        del kwargs['network']

        return dict(
            forward_func=forward_func,
            op_kwargs=kwargs,
            inv_data_func=inv_data_func,
            backward_func=backward_func,
            weights=weights,
            name=name,
            cls=cls,
            init_args=init_args)
def __getstate__ ( self ) : forward_func = self . op . _func inv_data_func = self . inversion_data . _func backward_func = self . inverse . _func network_params = self . op . network . state_dict ( ) weights = dict ( ( ( k , v . cpu ( ) . numpy ( ) ) for k , v in network_params . items ( ) ) ) cls = self . op . network . __class__ name = self . name init_args = extract_init_args ( self . op . network ) kwargs = dict ( self . op . kwargs ) del kwargs [ 'network' ] return dict ( forward_func = forward_func , op_kwargs = kwargs , inv_data_func = inv_data_func , backward_func = backward_func , weights = weights , name = name , cls = cls , init_args = init_args )
Extract serializable state from an instance