回答編集履歴
1
コード追記
test
CHANGED
@@ -1,3 +1,33 @@
|
|
1
1
|
`links`は 要素`('conv1', L.Convolution2D(3, 16, 3, 1, 0, w))`を1個持つ[リスト](https://docs.python.jp/3/library/stdtypes.html?highlight=%E3%83%AA%E3%82%B9%E3%83%88#list)です。
|
2
2
|
|
3
3
|
その要素`('conv1', L.Convolution2D(3, 16, 3, 1, 0, w))` は、`'conv1'`という文字列と、`L.Convolution2D(3, 16, 3, 1, 0, w)`の戻り値の、2個の要素を持つ[タプル](https://docs.python.jp/3/library/stdtypes.html?highlight=%E3%83%AA%E3%82%B9%E3%83%88#tuple)です。
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
```Python
|
8
|
+
|
9
|
+
def Convolution2D(a,b,c,d,e,f): # ダミー関数
|
10
|
+
|
11
|
+
return 123
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
w = 1
|
16
|
+
|
17
|
+
links = [('conv1', Convolution2D(3, 16, 3, 1, 0, w))]
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
print(type(links)) # <class 'list'>
|
22
|
+
|
23
|
+
print( links[0]) # ('conv1', 123)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
print(type(links[0])) # <class 'tuple'>
|
28
|
+
|
29
|
+
print( links[0][0]) # conv1
|
30
|
+
|
31
|
+
print( links[0][1]) # 123
|
32
|
+
|
33
|
+
```
|