version 0.0.4 cuda running neural network
This commit is contained in:
parent
77cabe41a2
commit
8c5abb226c
5 changed files with 3 additions and 32 deletions
|
|
@ -74,7 +74,7 @@ import random
|
|||
random.seed(1)
|
||||
|
||||
BATCH_SIZE = 32
|
||||
device = "cpu"
|
||||
device = "cuda" #cpu
|
||||
epochs = 10
|
||||
|
||||
transform = transforms.Sequential(
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
2
setup.py
2
setup.py
|
|
@ -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
27
test.py
|
|
@ -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")
|
||||
Loading…
Add table
Add a link
Reference in a new issue