state-spaces / mamba

Mamba SSM architecture
Apache License 2.0
12.7k stars 1.06k forks source link

How to get all hidden_states of selective_scan_cuda? #541

Open 0205090923 opened 1 month ago

0205090923 commented 1 month ago

hi, i wonder how to get all hidden_states of selective_scan_cuda, it seems only the last hidden_state can be used, out, x, *rest = selective_scan_cuda.fwd(u, delta, A, B, C, D, z, delta_bias, delta_softplus)

albertfgu commented 1 month ago

You can't get all hidden states from the fast code. You can materialize the states explicitly if you want them, which can be done directly in Python very easily.

jialiangZ commented 1 month ago

image I'm wondering if this final_state refers to the state depicted by the red circle in the figure