This is for initializing the hidden and cell states for lstm. Usually, we initialize them to zeros. By default, pytorch also initialize those states to zeros if you don’t pass them, so you actually don’t need the function.