Skip to content

Commit

Permalink
Define RSuperviseL model and use MSE as the criterion
Browse files Browse the repository at this point in the history
  • Loading branch information
alimoezzi committed Mar 15, 2021
1 parent 307053b commit 8d526ee
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion RNN_building_blocks.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"source": [
"import torch\n",
"from torch.utils.data import Dataset\n",
"from torch import optim\n",
"from torchvision import datasets, transforms\n",
"import torch.nn.functional as F\n",
"from torch import nn\n",
Expand Down Expand Up @@ -66,7 +67,48 @@
"\n",
"# mySeries dataset\n",
"trainset = mySeries()\n",
"trainloader = torch.utils.data.DataLoader(trainset, batch_size=64)\n"
"trainloader = torch.utils.data.DataLoader(trainset, batch_size=64)"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": 5,
"outputs": [],
"source": [
"class RSuperviseL(nn.Module):\n",
" def __init__(self):\n",
" super().__init__()\n",
" self.fc1 = nn.Linear(1, 1)\n",
"\n",
" def forward(self, x):\n",
"\n",
" self.fc1(x)\n",
" return x\n",
"\n",
"model = RSuperviseL()"
],
"metadata": {
"collapsed": false,
"pycharm": {
"name": "#%%\n"
}
}
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"criterion = nn.MSELoss()\n",
"optimizer = optim.Adadelta(model.parameters(), lr=0.01)\n",
"num_epochs = 30\n",
"train_tracker, test_tracker, accuracy_tracker = [], [], []"
],
"metadata": {
"collapsed": false,
Expand Down

0 comments on commit 8d526ee

Please sign in to comment.