Hi, I got a small piece of document from PyTorch Docs.


h_0: tensor of shape (D * \text{num_layers}, N, H_{out})(D∗num_layers,N,Hout​) containing the initial hidden state for each element in the batch. Defaults to zeros if (h_0, c_0) is not provided.

c_0: tensor of shape (D * \text{num_layers}, N, H_{cell})(D∗num_layers,N,Hcell​) containing the initial cell state for each element in the batch. Defaults to zeros if (h_0, c_0) is not provided.

When you don’t define your h_0 and c_0, the model automatically create a zeros tensor according to your input size.
Thanks