質問編集履歴

7

誤字

2022/08/21 11:14

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
  for convSet in convSetSet:
27
27
  self.modules.append(Conv2dBlock(convSet,device).to(device)) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
28
28
 
29
- #### 4⃣ NN parameterリストに登録できない:
29
+ #### 4⃣ NN parameterリストに登録してくれない:
30
30
  self.blocks = [nn.Sequential() for i in range(10)]
31
31
 
32
32
  self.blocks[0].add_module("Block1_ConvB1", Conv2dBlock(convSetSet[0],device))

6

修正

2022/08/21 10:05

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -17,11 +17,12 @@
17
17
  self.modules = [Conv2dBlock(convSetSet[0],device).to(device)]*10 #10個のNN layer生成したが、NNのパラメータListに反映してくれない
18
18
  print("\n self.modules= \n",self.modules )
19
19
 
20
+
20
- #### 2⃣ NN parameterリストに登録してくれない:
21
+ #### 2⃣ NN parameterリストに登録してくれない:
21
22
  for i,convSet in enumerate(convSetSet):
22
23
  self.modules[i] = Conv2dBlock(convSet,device).to(device) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
23
24
 
24
- #### 3⃣ NN parameterリストに登録してくれない:
25
+ #### 3⃣ NN parameterリストに登録してくれない:
25
26
  for convSet in convSetSet:
26
27
  self.modules.append(Conv2dBlock(convSet,device).to(device)) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
27
28
 

5

追加と修正

2022/08/21 10:01

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -13,17 +13,19 @@
13
13
  ]
14
14
 
15
15
 
16
- #### 1⃣ NN parameterリストに登録できない:
16
+ #### 1⃣ NN parameterリストに登録してくれない:
17
17
  self.modules = [Conv2dBlock(convSetSet[0],device).to(device)]*10 #10個のNN layer生成したが、NNのパラメータListに反映してくれない
18
- print("\n self.modules1 = \n",self.modules )
18
+ print("\n self.modules= \n",self.modules )
19
19
 
20
+ #### 2⃣ NN parameterリストに登録してくれない:
20
21
  for i,convSet in enumerate(convSetSet):
21
22
  self.modules[i] = Conv2dBlock(convSet,device).to(device) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
22
23
 
24
+ #### 3⃣ NN parameterリストに登録してくれない:
23
25
  for convSet in convSetSet:
24
26
  self.modules.append(Conv2dBlock(convSet,device).to(device)) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
25
27
 
26
- #### 2⃣ NN parameterリストに登録できない:
28
+ #### 4⃣ NN parameterリストに登録できない:
27
29
  self.blocks = [nn.Sequential() for i in range(10)]
28
30
 
29
31
  self.blocks[0].add_module("Block1_ConvB1", Conv2dBlock(convSetSet[0],device))
@@ -34,11 +36,12 @@
34
36
 
35
37
  #======================================================================#
36
38
 
37
- #### 3 NN parameterリストに登録できる:
39
+ #### 5⃣ NN parameterリストに登録できる:
38
40
  self.sequent = nn.Sequential()
39
41
  self.sequent.add_module("Block1_ConvB3", Conv2dBlock(convSetSet[2],device))
40
42
 
43
+ 上記5⃣の場合の結果:  
41
- 上記2⃣の場合の結果:  class CNN_generator(nn.Module)のinstanceのprint :
44
+ class CNN_generator(nn.Module)のinstanceのprint :
42
45
 
43
46
  (sequent): Sequential(
44
47
  (Block1_ConvB3): Conv2dBlock(
@@ -62,7 +65,7 @@
62
65
  def __init__(self,convSetSet,device):
63
66
  super(CNN_generator, self).__init__()
64
67
 
65
- #### 1⃣ NN parameterリストに登録できない:
68
+ #### 1⃣ NN parameterリストに登録してくれない:
66
69
 
67
70
  self.convBlocks = [Conv2dBlock(convSetSet[0],device).to(device)]*10
68
71
 

4

追加

2022/08/21 09:55

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -13,7 +13,7 @@
13
13
  ]
14
14
 
15
15
 
16
-
16
+ #### 1⃣ NN parameterリストに登録できない:
17
17
  self.modules = [Conv2dBlock(convSetSet[0],device).to(device)]*10 #10個のNN layer生成したが、NNのパラメータListに反映してくれない
18
18
  print("\n self.modules1 = \n",self.modules )
19
19
 
@@ -23,7 +23,7 @@
23
23
  for convSet in convSetSet:
24
24
  self.modules.append(Conv2dBlock(convSet,device).to(device)) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
25
25
 
26
- #### 1⃣ NN parameterリストに登録できない:
26
+ #### 2⃣ NN parameterリストに登録できない:
27
27
  self.blocks = [nn.Sequential() for i in range(10)]
28
28
 
29
29
  self.blocks[0].add_module("Block1_ConvB1", Conv2dBlock(convSetSet[0],device))
@@ -34,7 +34,7 @@
34
34
 
35
35
  #======================================================================#
36
36
 
37
- #### 2⃣ NN parameterリストに登録できる:
37
+ #### 3⃣ NN parameterリストに登録できる:
38
38
  self.sequent = nn.Sequential()
39
39
  self.sequent.add_module("Block1_ConvB3", Conv2dBlock(convSetSet[2],device))
40
40
 

3

追加

2022/08/21 09:53

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -5,7 +5,24 @@
5
5
  def __init__(self,convSetSet,device):
6
6
  super(CNN_generator, self).__init__()
7
7
 
8
+ convSetSet=[
9
+ [inChannels, outChannels[0], kernelSizes[0], { 'pReLu1':nn.PReLU(outChannels[0]).to(device) } ],
10
+ [outChannels[0], outChannels[1], kernelSizes[0], { 'pReLu2':nn.PReLU(outChannels[1]).to(device), 'MaxPool1':self.maxpool1, 'DropOut1':self.dropout1 } ],
11
+ [outChannels[1], outChannels[2], kernelSizes[0], { 'pReLu3':nn.PReLU(outChannels[2]).to(device) } ],
12
+ [outChannels[2], outChannels[3], kernelSizes[0], { 'pReLu4':nn.PReLU(outChannels[3]).to(device), 'DropOut2':self.dropout2, 'MaxPool2':self.maxpool2 } ]
13
+ ]
8
14
 
15
+
16
+
17
+ self.modules = [Conv2dBlock(convSetSet[0],device).to(device)]*10 #10個のNN layer生成したが、NNのパラメータListに反映してくれない
18
+ print("\n self.modules1 = \n",self.modules )
19
+
20
+ for i,convSet in enumerate(convSetSet):
21
+ self.modules[i] = Conv2dBlock(convSet,device).to(device) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
22
+
23
+ for convSet in convSetSet:
24
+ self.modules.append(Conv2dBlock(convSet,device).to(device)) #4個のNN layer生成したが、NNのパラメータListに反映してくれない
25
+
9
26
  #### 1⃣ NN parameterリストに登録できない:
10
27
  self.blocks = [nn.Sequential() for i in range(10)]
11
28
 

2

sdふぁsdf

2022/08/16 22:26

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -37,8 +37,7 @@
37
37
 
38
38
  ```
39
39
 
40
- **nn.Sequential()を利用せず、単刀直入の場合:
40
+ **nn.Sequential()を利用せず、単刀直入の場合**
41
- **
42
41
 
43
42
  ```Python
44
43
  class CNN_generator(nn.Module):

1

修正

2022/08/16 22:24

投稿

insecticide
insecticide

スコア315

test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,8 @@
60
60
  self.convBlock1 = Conv2dBlock(convSetSet[1],device).to(device)
61
61
  self.convBlock2 = Conv2dBlock(convSetSet[2],device).to(device)
62
62
 
63
+
63
- <結果>
64
+ 上記2⃣の場合の結果:  class CNN_generator(nn.Module)のinstanceのprint :
64
65
 
65
66
  (convBlock0): Conv2dBlock(
66
67
  (conv): Conv2d(1, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False, padding_mode=replicate)
@@ -91,7 +92,7 @@
91
92
 
92
93
  ```
93
94
 
94
- 原因説明できる方宜しくお願いいたします。 💖💖
95
+ 原因説明できる方宜しくお願いいたします。 💖💖
95
96
 
96
97
 
97
98