Skip preprocessing

My observation is a scipy sparse matrix. NoPreprocessing throws an error because it tries to .ravel() it. In the policy, I just use the raw observations anyway. Is there a way to skip the preprocessing altogether?

Hi @TheExGenesis,

I have used the following snippet to skip preprocessing before. It was a long time ago, pre ray 1.0 so it may no longer work. Looking at the NoPreprocessor code you are going to have to override the write method.

I have heard @sven1977 mention recently that getting rid of processors is in the plan but I am not sure of its status or timeline.

    class AbsolutelyNoPreprocessor(NoPreprocessor):

        @override(NoPreprocessor)
        def transform(self, observation):
            return observation

       @override(Preprocessor)
       def write(self, observation: TensorType, array: np.ndarray,
                        offset: int) -> None:
           pass # Your implementation goes here

    ModelCatalog.register_custom_preprocessor("absolutely_no_preprocessor",
                                              AbsolutelyNoPreprocessorGAN)
2 Likes