I am getting the following error , trying to create a simple rnn for implementing ctc based neural net   matrices expected, got 3D, 2D tensors
import torch 
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
import matplotlib
from __future__ import print_function

# Hyper Parameters
sequence_length = 2
input_size = 13
hidden_size = 4
num_layers = 2
num_classes = 3
batch_size = 1
num_epochs = 2
learning_rate = 0.01

class RNN(nn.Module):
    def __init__(self, input_size, hidden_size, num_layers, num_classes):
        super(RNN, self).__init__()
        self.hidden_size = hidden_size
        self.num_layers = num_layers
        self.rnn = nn.RNN(input_size, hidden_size, num_layers)
        self.fc = nn.Linear(hidden_size, num_classes)
    
    def forward(self, x):
        # Set initial states 
        h0 = Variable(torch.zeros(self.num_layers, 1 ,1, self.hidden_size)) 
        
        
        # Forward propagate RNN
        out, out2 = self.rnn(x, h0)  
        
        # Decode hidden state of last time step
       # out = self.fc(out[:, -1, :])  
        return out

rnn = RNN(input_size, hidden_size, num_layers, num_classes)

criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(rnn.parameters(), lr=learning_rate)

input = Variable(torch.randn(sequence_length, 1, 13))
h0 = Variable(torch.randn(2, 1, num_classes))
print(input)
output = rnn.forward(input)