代码块测试
公式
一个a可以产生a开头的句子
结果就是,不方便解析
单行公式
一个四元式 :非终结符集合
:终结符集合 :开始符号
:产生式的非空有限集
来个复杂公式
放置代码块
不声明语言 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#include "FontEngine.h"
FontEngine::FontEngine() {
if (FT_Init_FreeType(&library)) {
SysError(L"Failed to init freetype library");
}
if (FT_New_Face(library, "resources\\font\\LLtype.ttf", 0, &face)) {
SysError(L"Failed to load font");
}
debug_log("Loaded font \"%s\"\n", face->family_name);
if (FT_Set_Pixel_Sizes(face, 0, 128)) {
SysError(L"Failed to set font size");
}
if (FT_Select_Charmap(face, FT_ENCODING_UNICODE)) {
SysError(L"Failed to select charset");
}
#ifndef NDEBUG
load_char(L'A');
assert(face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY);
#endif // !NDEBUG
}
声明为c++ 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#include "FontEngine.h"
FontEngine::FontEngine() {
if (FT_Init_FreeType(&library)) {
SysError(L"Failed to init freetype library");
}
if (FT_New_Face(library, "resources\\font\\LLtype.ttf", 0, &face)) {
SysError(L"Failed to load font");
}
debug_log("Loaded font \"%s\"\n", face->family_name);
if (FT_Set_Pixel_Sizes(face, 0, 128)) {
SysError(L"Failed to set font size");
}
if (FT_Select_Charmap(face, FT_ENCODING_UNICODE)) {
SysError(L"Failed to select charset");
}
#ifndef NDEBUG
load_char(L'A');
assert(face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_GRAY);
#endif // !NDEBUG
}
Python 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
41import argparse
import torch
from torch.nn import Module
from common_layers import Conv2, Conv1
class Autoencoder(Module):
encoder: Module
decoder: Module
def __init__(self):
super(Autoencoder, self).__init__()
self.encoder = torch.nn.Sequential(
Conv2(3, 32),
torch.nn.MaxPool2d(2),
Conv2(32, 64),
torch.nn.MaxPool2d(2),
Conv2(64, 128),
torch.nn.MaxPool2d(2),
Conv2(128, 256),
torch.nn.MaxPool2d(2),
Conv2(256, 256)
)
self.decoder = torch.nn.Sequential(
torch.nn.ConvTranspose2d(256, 256, 4, stride=2, padding=1),
Conv2(256, 256),
torch.nn.ConvTranspose2d(256, 128, 4, stride=2, padding=1),
Conv2(128, 128),
torch.nn.ConvTranspose2d(128, 64, 4, stride=2, padding=1),
Conv2(64, 64),
torch.nn.ConvTranspose2d(64, 32, 4, stride=2, padding=1),
Conv2(32, 32),
torch.nn.Conv2d(32, 3, 1)
)
def forward(self, x: torch.Tensor):
encoded = self.encoder(x)
decoded = self.decoder(encoded)
return decoded
再放一张图图