How to deal with complex multi-input observation (1D and 2D)

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

I have an environment in which the observation is made of multiple tuples and 1 or more images (colour or greyscale).

Since I want to test the same algorithm with different observation spaces (such as less or more 1D parameters), I wish to dynamically handle the observation difference.

I read this:

And if I understood it well, that code is meant to solve this exact problem.

Question 1:
if len(component.shape) == 3 and isinstance(component, Box):
Does this mean it can only handle coloured images or 3 stacked grey-images?

Question 2 (the most noob one):
Where should I paste this code to make use of it?

Question 3:
Is there a similar pre-made solution for Torch models?