0%

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
\usepackage{CJK}
\usepackage{ifthen}

\newcommand{\CJKfontsize}[4]{%
\fontsize{#1}{#2 plus#3 minus #4}\selectfont}
\newcommand\zihao[1]{%
\ifthenelse{\equal{#1}{0}}{%
\CJKfontsize{42bp}{50.4pt}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{0-}}{%
\CJKfontsize{36bp}{43.2pt}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{1}}{%
\CJKfontsize{26bp}{31.2pt}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{1-}}{%
\CJKfontsize{24bp}{28.8pt}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{2}}{%
\CJKfontsize{22bp}{26.4pt}{.5pt}{.3pt}}{}%
\ifthenelse{\equal{#1}{2-}}{%
\CJKfontsize{18bp}{21.6pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{3}}{%
\CJKfontsize{16bp}{19.3pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{3-}}{%
\CJKfontsize{15bp}{18pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{4}}{%
\CJKfontsize{14bp}{16.8pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{4-}}{%
\CJKfontsize{12bp}{14.4pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{5}}{%
\CJKfontsize{10.5bp}{12.6pt}{.3pt}{.2pt}}{}%
\ifthenelse{\equal{#1}{5-}}{%
\CJKfontsize{9bp}{10.8pt}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{6}}{%
\CJKfontsize{7.5bp}{9pt}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{6-}}{%
\CJKfontsize{6.5bp}{7.8pt}{.2pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{7}}{%
\CJKfontsize{5.5bp}{6.6pt}{.1pt}{.1pt}}{}%
\ifthenelse{\equal{#1}{8}}{%
\CJKfontsize{5bp}{6pt}{.1pt}{.1pt}}{}}

下载MacTex并安装

1
http://www.tug.org/mactex/

Latex编译器TexShop的设置

安装完成后,会有TexShop编译器。

完成如下两个中文的环境设置:

  1. 设置默认的编译为Xelatex:Preferences—Typesetting—Default Command—Command Listed Below—XeLaTex;
  2. 设置语言编码为UTF-8:Preferences—Source—Encoding—Unicode(UTF-8);当然Text and Background Colors也可以设置为白字黑底;

测试中英文混搭

1
2
3
4
5
6
7
8
9
\documentclass{article}
\usepackage{fontspec}
\setmainfont{SimSun}

\begin{document}

Hello, \LaTeX3, 中文混搭效果。

\end{document}

在py文件里面写的

1
import matplot

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
>>> # an Embedding module containing 10 tensors of size 3
>>> embedding = nn.Embedding(10, 3)
>>> # a batch of 2 samples of 4 indices each
>>> input = Variable(torch.LongTensor([[1,2,4,5],[4,3,2,9]]))
>>> embedding(input)

Variable containing:
(0 ,.,.) =
-1.0822 1.2522 0.2434
0.8393 -0.6062 -0.3348
0.6597 0.0350 0.0837
0.5521 0.9447 0.0498

(1 ,.,.) =
0.6597 0.0350 0.0837
-0.1527 0.0877 0.4260
0.8393 -0.6062 -0.3348
-0.8738 -0.9054 0.4281
[torch.FloatTensor of size 2x4x3]

>>> # example with padding_idx
>>> embedding = nn.Embedding(10, 3, padding_idx=0)
>>> input = Variable(torch.LongTensor([[0,2,0,5]]))
>>> embedding(input)

Variable containing:
(0 ,.,.) =
0.0000 0.0000 0.0000
0.3452 0.4937 -0.9361
0.0000 0.0000 0.0000
0.0706 -2.1962 -0.6276
[torch.FloatTensor of size 1x4x3]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
MobileNetV2(
(features): Sequential(
(0): Sequential(
(0): Conv2d(5, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
(1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU(inplace)
)
(1): InvertedResidual(
(conv): Sequential(
(0): Conv2d(32, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=32, bias=False)
(4): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(32, 16, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(16, eps=1e-05, momentum=0.1, affine=True)
)
)
(2): InvertedResidual(
(conv): Sequential(
(0): Conv2d(16, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(96, 96, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=96, bias=False)
(4): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(96, 24, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(24, eps=1e-05, momentum=0.1, affine=True)
)
)
(3): InvertedResidual(
(conv): Sequential(
(0): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(144, 144, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=144, bias=False)
(4): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(144, 24, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(24, eps=1e-05, momentum=0.1, affine=True)
)
)
(4): InvertedResidual(
(conv): Sequential(
(0): Conv2d(24, 144, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(144, 144, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=144, bias=False)
(4): BatchNorm2d(144, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(144, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
)
)
(5): InvertedResidual(
(conv): Sequential(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False)
(4): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
)
)
(6): InvertedResidual(
(conv): Sequential(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(192, 192, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=192, bias=False)
(4): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(192, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True)
)
)
(7): InvertedResidual(
(conv): Sequential(
(0): Conv2d(32, 192, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(192, 192, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=192, bias=False)
(4): BatchNorm2d(192, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(192, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True)
)
)
(8): InvertedResidual(
(conv): Sequential(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(4): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True)
)
)
(9): InvertedResidual(
(conv): Sequential(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(4): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True)
)
)
(10): InvertedResidual(
(conv): Sequential(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(4): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(384, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True)
)
)
(11): InvertedResidual(
(conv): Sequential(
(0): Conv2d(64, 384, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(384, 384, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=384, bias=False)
(4): BatchNorm2d(384, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(384, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True)
)
)
(12): InvertedResidual(
(conv): Sequential(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False)
(4): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True)
)
)
(13): InvertedResidual(
(conv): Sequential(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(576, 576, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=576, bias=False)
(4): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(576, 96, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(96, eps=1e-05, momentum=0.1, affine=True)
)
)
(14): InvertedResidual(
(conv): Sequential(
(0): Conv2d(96, 576, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(576, 576, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), groups=576, bias=False)
(4): BatchNorm2d(576, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(576, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True)
)
)
(15): InvertedResidual(
(conv): Sequential(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(4): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True)
)
)
(16): InvertedResidual(
(conv): Sequential(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(4): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(960, 160, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(160, eps=1e-05, momentum=0.1, affine=True)
)
)
(17): InvertedResidual(
(conv): Sequential(
(0): Conv2d(160, 960, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU6(inplace)
(3): Conv2d(960, 960, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=960, bias=False)
(4): BatchNorm2d(960, eps=1e-05, momentum=0.1, affine=True)
(5): ReLU6(inplace)
(6): Conv2d(960, 320, kernel_size=(1, 1), stride=(1, 1), bias=False)
(7): BatchNorm2d(320, eps=1e-05, momentum=0.1, affine=True)
)
)
(18): Sequential(
(0): Conv2d(320, 1280, kernel_size=(1, 1), stride=(1, 1), bias=False)
(1): BatchNorm2d(1280, eps=1e-05, momentum=0.1, affine=True)
(2): ReLU(inplace)
)
(19): AvgPool2d(kernel_size=7, stride=7, padding=0, ceil_mode=False, count_include_pad=True)
)
(classifier): Sequential(
(0): Dropout(p=0.5)
(1): Linear(in_features=1280, out_features=32, bias=True)
)
)

第一种是 先depth-wise卷积,后升维
第二种是 先降维,然后卷积,然后升维

1
2
import matplotlib as mpl
mpl.rcParams['figure.dpi']= 230