Most layer types in torch.nn such as torch.nn.Linear accept input with more than one dimension. Is there any advantage in doing so if you can shape your data to represent a certain arrangement in order to encode positional information?

For example, given you have only one type of data (feature dimension = 1) and 240 samples in the form of subsequent time slots of 1 hour. Is there any potential benefit in changing this from (240, 1) to (10, 24, 1) in order to assign hours to days or will torch still view this just as a sequence of time slots/hours? My current understanding is that torch will do the latter without an error and can do the former if you give it the full dimensional information when initializing the layer. In this case that would be (24, 1) instead of 1. I can't find any official source for that though.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.