index.html 16.1 KB
Newer Older
1
<!DOCTYPE html>
2 3 4 5 6 7 8 9
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  
10 11
  <link rel="shortcut icon" href="../img/favicon.ico">
  <title>硬件延时评估表 - PaddleSlim Docs</title>
12
  <link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
13

14 15
  <link rel="stylesheet" href="../css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
16 17 18 19 20
  <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
  
  <script>
    // Current page data
    var mkdocs_page_name = "\u786c\u4ef6\u5ef6\u65f6\u8bc4\u4f30\u8868";
21
    var mkdocs_page_input_path = "table_latency.md";
22 23 24
    var mkdocs_page_url = null;
  </script>
  
25 26
  <script src="../js/jquery-2.1.1.min.js" defer></script>
  <script src="../js/modernizr-2.8.3.min.js" defer></script>
27 28 29 30
  <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
  <script>hljs.initHighlightingOnLoad();</script> 
  
</head>
31

32
<body class="wy-body-for-nav" role="document">
33

34
  <div class="wy-grid-for-nav">
35

36 37 38
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
      <div class="wy-side-nav-search">
39
        <a href=".." class="icon icon-home"> PaddleSlim Docs</a>
40
        <div role="search">
41
  <form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
42 43 44 45
    <input type="text" name="q" placeholder="Search docs" title="Type search term here" />
  </form>
</div>
      </div>
46

47 48 49 50 51 52
      <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
	<ul class="current">
	  
          
            <li class="toctree-l1">
		
53
    <a class="" href="..">Home</a>
54 55 56 57
	    </li>
          
            <li class="toctree-l1">
		
58
    <span class="caption-text">教程</span>
59 60 61
    <ul class="subnav">
                <li class="">
                    
62
    <a class="" href="../tutorials/quant_post_demo/">离线量化</a>
63 64 65
                </li>
                <li class="">
                    
66
    <a class="" href="../tutorials/quant_aware_demo/">量化训练</a>
67
                </li>
68
                <li class="">
69
                    
70
    <a class="" href="../tutorials/quant_embedding_demo/">Embedding量化</a>
71
                </li>
72
                <li class="">
73
                    
74
    <a class="" href="../tutorials/nas_demo/">SA搜索</a>
75 76
                </li>
    </ul>
77 78 79 80 81
	    </li>
          
            <li class="toctree-l1">
		
    <span class="caption-text">API</span>
82
    <ul class="subnav">
83
                <li class="">
84
                    
85
    <a class="" href="../api/quantization_api/">量化</a>
86
                </li>
87
                <li class="">
88
                    
89
    <a class="" href="../api/prune_api/">剪枝</a>
90
                </li>
91
                <li class="">
92
                    
93
    <a class="" href="../api/analysis_api/">敏感度分析</a>
94
                </li>
95
                <li class="">
96
                    
97
    <a class="" href="../api/single_distiller_api/">蒸馏</a>
98
                </li>
99
                <li class="">
100
                    
101
    <a class="" href="../api/nas_api/">SA搜索</a>
102
                </li>
103 104 105
                <li class="">
                    
    <a class="" href="../api/search_space/">搜索空间</a>
106 107 108 109 110 111 112 113
                </li>
    </ul>
	    </li>
          
        </ul>
      </div>
      &nbsp;
    </nav>
114

115
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
116

117 118 119
      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
120
        <a href="..">PaddleSlim Docs</a>
121
      </nav>
122

123 124 125 126 127
      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
128
    <li><a href="..">Docs</a> &raquo;</li>
129 130 131 132 133 134
    
      
    
    <li>硬件延时评估表</li>
    <li class="wy-breadcrumbs-aside">
      
135 136 137
        <a href="https://github.com/PaddlePaddle/PaddleSlim/edit/master/docs/table_latency.md"
          class="icon icon-github"> Edit on GitHub</a>
      
138 139 140 141 142 143 144
    </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
145
                <h1 id="_1">硬件延时评估表<a class="headerlink" href="#_1" title="Permanent link">#</a></h1>
146 147
<p>硬件延时评估表用于快速评估一个模型在特定硬件环境和推理引擎上的推理速度。
该文档主要用于定义PaddleSlim支持的硬件延时评估表的格式。</p>
148
<h2 id="_2">概述<a class="headerlink" href="#_2" title="Permanent link">#</a></h2>
149 150
<p>硬件延时评估表中存放着所有可能的操作对应的延时信息,该表中的一个操作包括操作类型和操作参数,比如:操作类型可以是<code>conv2d</code>,对应的操作参数有输入特征图的大小、卷积核个数、卷积核大小等。
给定操作的延时依赖于硬件环境和推理引擎。</p>
151
<h2 id="_3">整体格式<a class="headerlink" href="#_3" title="Permanent link">#</a></h2>
152 153
<p>硬件延时评估表以文件或多行字符串的形式保存。</p>
<p>硬件延时评估表第一行保存版本信息,后续每行为一个操作和对应的延时信息。</p>
154
<h2 id="_4">版本信息<a class="headerlink" href="#_4" title="Permanent link">#</a></h2>
155 156 157 158 159 160 161 162 163 164 165 166
<p>版本信息以英文字符逗号分割,内容依次为硬件环境名称、推理引擎名称和时间戳。</p>
<ul>
<li>
<p><strong>硬件环境名称:</strong> 用于标识硬件环境,可以包含计算架构类型、版本号等信息。</p>
</li>
<li>
<p><strong>推理引擎名称:</strong> 用于标识推理引擎,可以包含推理引擎名称、版本号、优化选项等信息。</p>
</li>
<li>
<p><strong>时间戳:</strong> 该评估表的创建时间。</p>
</li>
</ul>
167
<h2 id="_5">操作信息<a class="headerlink" href="#_5" title="Permanent link">#</a></h2>
168
<p>操作信息字段之间以逗号分割。操作信息与延迟信息之间以制表符分割。</p>
169
<h3 id="conv2d">conv2d<a class="headerlink" href="#conv2d" title="Permanent link">#</a></h3>
170
<p><strong>格式</strong></p>
171
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">flag_bias</span><span class="p">,</span><span class="n">flag_relu</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="p">,</span><span class="n">c_out</span><span class="p">,</span><span class="n">groups</span><span class="p">,</span><span class="n">kernel</span><span class="p">,</span><span class="n">padding</span><span class="p">,</span><span class="n">stride</span><span class="p">,</span><span class="n">dilation</span><span class="err">\</span><span class="n">tlatency</span>
172
</pre></div>
173
</td></tr></table>
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>flag_bias (int)</strong> - 是否有 bias(0:无,1:有)。</li>
<li><strong>flag_relu (int)</strong> - 是否有 relu(0:无,1:有)。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>c_out (int)</strong> - 输出 Tensor 的通道 (channel) 数。</li>
<li><strong>groups (int)</strong> - 卷积二维层(Conv2D Layer)的组数。</li>
<li><strong>kernel (int)</strong> - 卷积核大小。</li>
<li><strong>padding (int)</strong> - 填充 (padding) 大小。</li>
<li><strong>stride (int)</strong> - 步长 (stride) 大小。</li>
<li><strong>dilation (int)</strong> - 膨胀 (dilation) 大小。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
</ul>
192
<h3 id="activation">activation<a class="headerlink" href="#activation" title="Permanent link">#</a></h3>
193
<p><strong>格式</strong></p>
194
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="err">\</span><span class="n">tlatency</span>
195
</pre></div>
196
</td></tr></table>
197 198 199 200 201 202 203 204 205 206

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
</ul>
207
<h3 id="batch_norm">batch_norm<a class="headerlink" href="#batch_norm" title="Permanent link">#</a></h3>
208
<p><strong>格式</strong></p>
209
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">active_type</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="err">\</span><span class="n">tlatency</span>
210
</pre></div>
211
</td></tr></table>
212 213 214 215 216 217 218 219 220 221 222

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>active_type (string)</strong> - 激活函数类型,包含:relu, prelu, sigmoid, relu6, tanh。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
</ul>
223
<h3 id="eltwise">eltwise<a class="headerlink" href="#eltwise" title="Permanent link">#</a></h3>
224
<p><strong>格式</strong></p>
225
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="err">\</span><span class="n">tlatency</span>
226
</pre></div>
227
</td></tr></table>
228 229 230 231 232 233 234 235 236 237

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
</ul>
238
<h3 id="pooling">pooling<a class="headerlink" href="#pooling" title="Permanent link">#</a></h3>
239
<p><strong>格式</strong></p>
240
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">flag_global_pooling</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="p">,</span><span class="n">kernel</span><span class="p">,</span><span class="n">padding</span><span class="p">,</span><span class="n">stride</span><span class="p">,</span><span class="n">ceil_mode</span><span class="p">,</span><span class="n">pool_type</span><span class="err">\</span><span class="n">tlatency</span>
241
</pre></div>
242
</td></tr></table>
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>flag_global_pooling (int)</strong> - 是否为全局池化(0:不是,1:是)。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>kernel (int)</strong> - 卷积核大小。</li>
<li><strong>padding (int)</strong> - 填充 (padding) 大小。</li>
<li><strong>stride (int)</strong> - 步长 (stride) 大小。</li>
<li><strong>ceil_mode (int)</strong> - 是否用 ceil 函数计算输出高度和宽度。0 表示使用 floor 函数,1 表示使用 ceil 函数。</li>
<li><strong>pool_type (int)</strong> - 池化类型,其中 1 表示 pooling_max,2 表示 pooling_average_include_padding,3 表示 pooling_average_exclude_padding。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
</ul>
259
<h3 id="softmax">softmax<a class="headerlink" href="#softmax" title="Permanent link">#</a></h3>
260
<p><strong>格式</strong></p>
261
<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span>1</pre></div></td><td class="code"><div class="codehilite"><pre><span></span><span class="n">op_type</span><span class="p">,</span><span class="n">axis</span><span class="p">,</span><span class="n">n_in</span><span class="p">,</span><span class="n">c_in</span><span class="p">,</span><span class="n">h_in</span><span class="p">,</span><span class="n">w_in</span><span class="err">\</span><span class="n">tlatency</span>
262
</pre></div>
263
</td></tr></table>
264 265 266 267 268 269 270 271 272 273

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
<li><strong>axis (int)</strong> - 执行 softmax 计算的维度索引,应该在 [−1,rank − 1] 范围内,其中 rank 是输入变量的秩。</li>
<li><strong>n_in (int)</strong> - 输入 Tensor 的批尺寸 (batch size)。</li>
<li><strong>c_in (int)</strong> - 输入 Tensor 的通道 (channel) 数。</li>
<li><strong>h_in (int)</strong> - 输入 Tensor 的特征高度。</li>
<li><strong>w_in (int)</strong> - 输入 Tensor 的特征宽度。</li>
<li><strong>latency (float)</strong> - 当前op的延时时间</li>
274 275
</ul>
              
276
            </div>
277 278 279 280 281 282 283 284 285 286 287 288 289 290
          </div>
          <footer>
  

  <hr/>

  <div role="contentinfo">
    <!-- Copyright etc -->
    
  </div>

  Built with <a href="http://www.mkdocs.org">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
      
291
        </div>
292 293 294 295 296 297 298 299 300
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
301
          <a href="https://github.com/PaddlePaddle/PaddleSlim/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
302 303 304 305
      
      
      
    </span>
306
</div>
307 308 309 310 311
    <script>var base_url = '..';</script>
    <script src="../js/theme.js" defer></script>
      <script src="../mathjax-config.js" defer></script>
      <script src="../MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
      <script src="../search/main.js" defer></script>
312

313
</body>
314
</html>