version 0.0.4 cuda running neural network

This commit is contained in:
lucasdelimanogueira 2024-05-23 12:28:17 -03:00
parent 77cabe41a2
commit 8c5abb226c
5 changed files with 3 additions and 32 deletions

View file

@ -74,7 +74,7 @@ import random
random.seed(1)
BATCH_SIZE = 32
device = "cpu"
device = "cuda" #cpu
epochs = 10
transform = transforms.Sequential(

View file

@ -99,7 +99,7 @@
"outputs": [],
"source": [
"BATCH_SIZE = 32\n",
"device = \"cpu\"\n",
"device = \"cuda\" #cpu\n",
"epochs = 10\n",
"\n",
"transform = transforms.Sequential(\n",

View file

@ -29,6 +29,4 @@ def one_hot_encode(x, num_classes):
target_idx = int(x[i])
one_hot[i][target_idx] = 1
return norch.Tensor(one_hot)

View file

@ -20,7 +20,7 @@ class CustomInstall(install):
setuptools.setup(
name = "norch",
version = "0.0.3",
version = "0.0.4",
author = "Lucas de Lima",
author_email = "nogueiralucasdelima@gmail.com",
description = "A deep learning framework",

27
test.py
View file

@ -1,27 +0,0 @@
import norch
import norch.nn as nn
import norch.optim as optim
from norch.utils.data.dataloader import Dataloader
from norch.norchvision import transforms
import numpy as np
import matplotlib.pyplot as plt
import random
random.seed(1)
class MyModel(nn.Module):
def __init__(self):
super(MyModel, self).__init__()
self.fc1 = nn.Linear(784, 30)
self.sigmoid1 = nn.Sigmoid()
self.fc2 = nn.Linear(30, 10)
self.sigmoid2 = nn.Sigmoid()
def forward(self, x):
out = self.fc1(x)
out = self.sigmoid1(out)
out = self.fc2(out)
out = self.sigmoid2(out)
return out
model = MyModel().to("cuda")