srush / annotated-s4

Implementation of https://srush.github.io/annotated-s4
https://srush.github.io/annotated-s4
MIT License
468 stars 60 forks source link

Question, why does the reshape function has no argument? #41

Closed JonathanSum closed 2 years ago

JonathanSum commented 2 years ago

Hi. I see the reshape function does not take arguments. image I guess this is not an error. If so, can someone explain to me what shape it is going to have from the original shape?

srush commented 2 years ago

It just turns it into a jax scalar

import jax.numpy as np np.array([1]).reshape().shape

()

This function could be written in a much more efficient way, just wanted to show it in a non-matrix style.

JonathanSum commented 2 years ago

Thx for answering. But It is just "reshape()" in the code, not "reshape().shape"

srush commented 2 years ago

I was just showing that the shape is () after reshape, i.e. scalar