mlech26l / ncps

PyTorch and TensorFlow implementation of NCP, LTC, and CfC wired neural models
https://www.nature.com/articles/s42256-020-00237-3
Apache License 2.0
1.86k stars 297 forks source link

Defining equal input and output shapes for LTC #61

Open mhni-ES opened 5 months ago

mhni-ES commented 5 months ago

Hi Liquid AI Team,

I'm reaching out to inquire about the capabilities of the Liquid Time Constant (LTC) network in handling time series data, specifically regarding the output shape consistency with the input shape.

We are currently working with time series data structured as (None, 128, 14, 4). Our objective is to have the LTC network process this data while maintaining the same output shape as the input. However, based on the provided examples, particularly those involving sinusoidal data, it seems that maintaining the input shape in the output might not be possible with LTC.

Could you provide some clarification on this? If maintaining the input shape in the LTC output is feasible, guidance on how to achieve this would be immensely helpful. Any additional information or direction you could offer would be greatly appreciated.

DaBihy commented 5 months ago

Absolutely, you can keep the output shape the same as the input shape in an LTC network. For an input shape of (None, 128, 14, 4), first reshape your input to (None, 128, 56) . Then, set return_sequences=True in your model. This ensures that the output for each time step is returned, keeping the time dimension consistent. Also, set the output_size to 56 in your wiring forLTC network's configuration. Finally, after processing, reshape the output back to (None, 128, 14, 4). This will give you the output in the same shape as your input.