1
+ {
2
+ "nbformat" : 4 ,
3
+ "nbformat_minor" : 0 ,
4
+ "metadata" : {
5
+ "colab" : {
6
+ "name" : " task2.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" : " 841adttKIgfL" ,
19
+ "colab_type" : " code" ,
20
+ "colab" : {}
21
+ },
22
+ "source" : [
23
+ " import torch.nn as nn\n " ,
24
+ " import torch"
25
+ ],
26
+ "execution_count" : 0 ,
27
+ "outputs" : []
28
+ },
29
+ {
30
+ "cell_type" : " code" ,
31
+ "metadata" : {
32
+ "id" : " 7KbBAQjNIvdx" ,
33
+ "colab_type" : " code" ,
34
+ "colab" : {}
35
+ },
36
+ "source" : [
37
+ " \n " ,
38
+ " class Network(nn.Module):\n " ,
39
+ " def __init__(self,N_in,N_out):\n " ,
40
+ " super(Network, self).__init__()\n " ,
41
+ " self.input = nn.Linear(N_in, 400)\n " ,
42
+ " self.fc1 = nn.Linear(400, 100)\n " ,
43
+ " self.fc2 = nn.Linear(100, 50)\n " ,
44
+ " self.output = nn.Linear(50, N_out)\n " ,
45
+ " self.sigmoid = nn.Sigmoid()\n " ,
46
+ " \n " ,
47
+ " \n " ,
48
+ " def forward(self, x):\n " ,
49
+ " \t x=self.input(x)\n " ,
50
+ " \t x= self.fc1(x)\n " ,
51
+ " \t x = self.sigmoid(x)\n " ,
52
+ " \t x=self.fc2(x)\n " ,
53
+ " \t x = self.Output(x)\n " ,
54
+ " \t return x"
55
+ ],
56
+ "execution_count" : 0 ,
57
+ "outputs" : []
58
+ },
59
+ {
60
+ "cell_type" : " code" ,
61
+ "metadata" : {
62
+ "id" : " SE7W9rpxI-iH" ,
63
+ "colab_type" : " code" ,
64
+ "colab" : {}
65
+ },
66
+ "source" : [
67
+ " network = Network(800,25)"
68
+ ],
69
+ "execution_count" : 0 ,
70
+ "outputs" : []
71
+ },
72
+ {
73
+ "cell_type" : " code" ,
74
+ "metadata" : {
75
+ "id" : " HsOAqG1dJC8N" ,
76
+ "colab_type" : " code" ,
77
+ "colab" : {
78
+ "base_uri" : " https://localhost:8080/" ,
79
+ "height" : 136
80
+ },
81
+ "outputId" : " 901cf8b4-38f4-4570-ca32-bf3821460af4"
82
+ },
83
+ "source" : [
84
+ " network"
85
+ ],
86
+ "execution_count" : 4 ,
87
+ "outputs" : [
88
+ {
89
+ "output_type" : " execute_result" ,
90
+ "data" : {
91
+ "text/plain" : [
92
+ " Network(\n " ,
93
+ " (input): Linear(in_features=800, out_features=400, bias=True)\n " ,
94
+ " (fc1): Linear(in_features=400, out_features=100, bias=True)\n " ,
95
+ " (fc2): Linear(in_features=100, out_features=50, bias=True)\n " ,
96
+ " (output): Linear(in_features=50, out_features=25, bias=True)\n " ,
97
+ " (sigmoid): Sigmoid()\n " ,
98
+ " )"
99
+ ]
100
+ },
101
+ "metadata" : {
102
+ "tags" : []
103
+ },
104
+ "execution_count" : 4
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "cell_type" : " code" ,
110
+ "metadata" : {
111
+ "id" : " sKGnDl15Jr75" ,
112
+ "colab_type" : " code" ,
113
+ "colab" : {}
114
+ },
115
+ "source" : [
116
+ " "
117
+ ],
118
+ "execution_count" : 0 ,
119
+ "outputs" : []
120
+ }
121
+ ]
122
+ }
0 commit comments