type or paimport json # importing the module
from nlp_utils import tokenize, stemming, bag_of_words
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from model import NeuralNet


with open("input_data.json", "r") as f:  # opening the json file in read mode
    intents = json.load(f)  # fiiting the file in the variable

all_words = []
tags = []
xy = []

for intent in intents['intents']:
    tag = intent["tag"]
    tags.append(tag)
    for pattern in intent['patterns']:
        w = tokenize(pattern)
        all_words.extend(w)
        xy.append((w, tag))

ignore_words = ['?', '.', ',', '!']
all_words = [stemming(w) for w in all_words if w not in ignore_words]
all_words = sorted(set(all_words))
tags = sorted(set(tags))
x_train = []
y_train = []
for (pattern_sentence, tag) in xy:
    bag = bag_of_words(pattern_sentence, all_words)
    x_train.append(bag)

    label = tags.index(tag)
    y_train.append(label)


x_train = np.array(x_train)
y_train = np.array(y_train)

class Chat_Dataset(Dataset):
    def __init__(self):
        self.n_samples = len(x_train)
        self.x_data = x_train
        self.y_data = y_train
    def __getitem__(self, index):
        return self.x_data[index], self.y_data[index]

    def __len__(self):
        return self.n_samples

# hyperparameter

batch_size = 8
h_s = 8
o_s = len(tags)
i_s = len(x_train[0])
learning_rate = 0.001
num_epochs = 1000


dataset = Chat_Dataset()
train_loader = DataLoader(dataset=dataset, batch_size=batch_size, shuffle=True, num_workers=0)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

model = NeuralNet(input_size=i_s, hidden_size=h_s, num_classes=o_s).to(device)

# loss and optimizer
criterion = nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), lr=learning_rate)

for epoch in range(num_epochs):
    for (word, labels) in train_loader:
        word = word.to(device)
        labels = labels.to(device)

        # forwards
        outputs = model(word)
        loss = criterion(outputs, labels)

        # backward and optimizer
        optimizer.zero_grad()
        loss.backward()
        optimizer.step()

    if (epoch + 1) % 100 == 0:
        print(f'epoch {epoch+1}/{num_epochs}, loss={loss.item():.4f}')


print(f'final loss, loss={loss.item():.4f}')






i am getting this error
C:\Users\docto\anaconda3\python.exe C:/Users/docto/PycharmProjects/DataScience/DocVedic_updates/train.py
Traceback (most recent call last):
File “C:/Users/docto/PycharmProjects/DataScience/DocVedic_updates/train.py”, line 79, in 
outputs = model(word)
File “C:\Users\docto\anaconda3\lib\site-packages\torch\nn\modules\module.py”, line 889, in _call_impl
result = self.forward(*input, **kwargs)
File “C:\Users\docto\PycharmProjects\DataScience\DocVedic_updates\model.py”, line 18, in forward
out = self.l3(x)
File “C:\Users\docto\anaconda3\lib\site-packages\torch\nn\modules\module.py”, line 889, in _call_impl
result = self.forward(*input, **kwargs)
File “C:\Users\docto\anaconda3\lib\site-packages\torch\nn\modules\linear.py”, line 94, in forward
return F.linear(input, self.weight, self.bias)
File “C:\Users\docto\anaconda3\lib\site-packages\torch\nn\functional.py”, line 1753, in linear
return torch._C._nn.linear(input, weight, bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (8x44 and 8x7)