1
+ {
2
+ "nbformat" : 4 ,
3
+ "nbformat_minor" : 0 ,
4
+ "metadata" : {
5
+ "colab" : {
6
+ "name" : " tinkerhubpytorch.ipynb" ,
7
+ "provenance" : []
8
+ },
9
+ "kernelspec" : {
10
+ "name" : " python3" ,
11
+ "display_name" : " Python 3"
12
+ }
13
+ },
14
+ "cells" : [
15
+ {
16
+ "cell_type" : " code" ,
17
+ "metadata" : {
18
+ "id" : " p_XfBfF72I13" ,
19
+ "colab_type" : " code" ,
20
+ "colab" : {}
21
+ },
22
+ "source" : [
23
+ " import torch.nn as nn\n " ,
24
+ " import torch.nn.functional as F\n " ,
25
+ " class Net(nn.Module):\n " ,
26
+ " def __init__(self,):\n " ,
27
+ " super(Net, self).__init__()\n " ,
28
+ " self.fc1 = nn.Linear(256,64)\n " ,
29
+ " self.fc2 = nn.Linear(64,32)\n " ,
30
+ " self.fc3 = nn.Linear(32, 10)\n " ,
31
+ " def forward(self, x):\n " ,
32
+ " x = self.fc1(x)\n " ,
33
+ " x = F.Sigmoid(x)\n " ,
34
+ " x = self.fc2(x)\n " ,
35
+ " x = F.Sigmoid(x)\n " ,
36
+ " x = self.fc3(x)\n " ,
37
+ " return x\n "
38
+ ],
39
+ "execution_count" : 0 ,
40
+ "outputs" : []
41
+ },
42
+ {
43
+ "cell_type" : " code" ,
44
+ "metadata" : {
45
+ "id" : " oqld3eV4veTJ" ,
46
+ "colab_type" : " code" ,
47
+ "colab" : {}
48
+ },
49
+ "source" : [
50
+ " model = Net()"
51
+ ],
52
+ "execution_count" : 0 ,
53
+ "outputs" : []
54
+ },
55
+ {
56
+ "cell_type" : " code" ,
57
+ "metadata" : {
58
+ "id" : " pjLG2lp2vgmS" ,
59
+ "colab_type" : " code" ,
60
+ "colab" : {
61
+ "base_uri" : " https://localhost:8080/" ,
62
+ "height" : 104
63
+ },
64
+ "outputId" : " 52d81444-c0a7-4e70-fc62-517e035fccb2"
65
+ },
66
+ "source" : [
67
+ " model"
68
+ ],
69
+ "execution_count" : 42 ,
70
+ "outputs" : [
71
+ {
72
+ "output_type" : " execute_result" ,
73
+ "data" : {
74
+ "text/plain" : [
75
+ " Net(\n " ,
76
+ " (fc1): Linear(in_features=256, out_features=64, bias=True)\n " ,
77
+ " (fc2): Linear(in_features=64, out_features=32, bias=True)\n " ,
78
+ " (fc3): Linear(in_features=32, out_features=10, bias=True)\n " ,
79
+ " )"
80
+ ]
81
+ },
82
+ "metadata" : {
83
+ "tags" : []
84
+ },
85
+ "execution_count" : 42
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ }
0 commit comments