index.html 18.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">API</span>
59
    <ul class="subnav">
60
                <li class="">
61
                    
62
    <a class="" href="../api/quantization_api/">量化</a>
63
                </li>
64
                <li class="">
65
                    
66
    <a class="" href="../api/prune_api/">剪枝与敏感度</a>
67
                </li>
68
                <li class="">
69
                    
70
    <a class="" href="../api/analysis_api/">模型分析</a>
71
                </li>
72
                <li class="">
73
                    
74
    <a class="" href="../api/single_distiller_api/">知识蒸馏</a>
75
                </li>
76
                <li class="">
77
                    
78
    <a class="" href="../api/nas_api/">SA搜索</a>
79
                </li>
80 81 82
                <li class="">
                    
    <a class="" href="../api/search_space/">搜索空间</a>
83
                </li>
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
                <li class=" current">
                    
    <a class="current" href="./">硬件延时评估表</a>
    <ul class="subnav">
            
    <li class="toctree-l3"><a href="#_1">硬件延时评估表</a></li>
    
        <ul>
        
            <li><a class="toctree-l4" href="#_2">概述</a></li>
        
            <li><a class="toctree-l4" href="#_3">整体格式</a></li>
        
            <li><a class="toctree-l4" href="#_4">版本信息</a></li>
        
            <li><a class="toctree-l4" href="#_5">操作信息</a></li>
        
        </ul>
    

    </ul>
                </li>
106 107 108
    </ul>
	    </li>
          
109 110
            <li class="toctree-l1">
		
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
    <span class="caption-text">教程</span>
    <ul class="subnav">
                <li class="">
                    
    <a class="" href="../tutorials/quant_post_demo/">离线量化</a>
                </li>
                <li class="">
                    
    <a class="" href="../tutorials/quant_aware_demo/">量化训练</a>
                </li>
                <li class="">
                    
    <a class="" href="../tutorials/quant_embedding_demo/">Embedding量化</a>
                </li>
                <li class="">
                    
    <a class="" href="../tutorials/nas_demo/">SA搜索</a>
                </li>
                <li class="">
                    
    <a class="" href="../tutorials/distillation_demo/">知识蒸馏</a>
                </li>
    </ul>
	    </li>
          
            <li class="toctree-l1">
		
138 139 140
    <a class="" href="../algo/algo/">算法原理</a>
	    </li>
          
141 142 143 144 145
            <li class="toctree-l1">
		
    <a class="" href="../model_zoo/">模型库</a>
	    </li>
          
146 147 148 149 150
            <li class="toctree-l1">
		
    <a class="" href="../model_zoo2/">模型库2</a>
	    </li>
          
151 152 153 154 155
            <li class="toctree-l1">
		
    <a class="" href="../model_zoo3/">模型库3</a>
	    </li>
          
156 157 158 159
        </ul>
      </div>
      &nbsp;
    </nav>
160

161
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
162

163 164 165
      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
166
        <a href="..">PaddleSlim Docs</a>
167
      </nav>
168

169 170 171 172 173
      
      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
174
    <li><a href="..">Docs</a> &raquo;</li>
175 176
    
      
177 178 179 180
        
          <li>API &raquo;</li>
        
      
181 182 183 184
    
    <li>硬件延时评估表</li>
    <li class="wy-breadcrumbs-aside">
      
185 186 187
        <a href="https://github.com/PaddlePaddle/PaddleSlim/edit/master/docs/table_latency.md"
          class="icon icon-github"> Edit on GitHub</a>
      
188 189 190 191 192 193 194
    </li>
  </ul>
  <hr/>
</div>
          <div role="main">
            <div class="section">
              
195
                <h1 id="_1">硬件延时评估表<a class="headerlink" href="#_1" title="Permanent link">#</a></h1>
196 197
<p>硬件延时评估表用于快速评估一个模型在特定硬件环境和推理引擎上的推理速度。
该文档主要用于定义PaddleSlim支持的硬件延时评估表的格式。</p>
198
<h2 id="_2">概述<a class="headerlink" href="#_2" title="Permanent link">#</a></h2>
199 200
<p>硬件延时评估表中存放着所有可能的操作对应的延时信息,该表中的一个操作包括操作类型和操作参数,比如:操作类型可以是<code>conv2d</code>,对应的操作参数有输入特征图的大小、卷积核个数、卷积核大小等。
给定操作的延时依赖于硬件环境和推理引擎。</p>
201
<h2 id="_3">整体格式<a class="headerlink" href="#_3" title="Permanent link">#</a></h2>
202 203
<p>硬件延时评估表以文件或多行字符串的形式保存。</p>
<p>硬件延时评估表第一行保存版本信息,后续每行为一个操作和对应的延时信息。</p>
204
<h2 id="_4">版本信息<a class="headerlink" href="#_4" title="Permanent link">#</a></h2>
205 206 207 208 209 210 211 212 213 214 215 216
<p>版本信息以英文字符逗号分割,内容依次为硬件环境名称、推理引擎名称和时间戳。</p>
<ul>
<li>
<p><strong>硬件环境名称:</strong> 用于标识硬件环境,可以包含计算架构类型、版本号等信息。</p>
</li>
<li>
<p><strong>推理引擎名称:</strong> 用于标识推理引擎,可以包含推理引擎名称、版本号、优化选项等信息。</p>
</li>
<li>
<p><strong>时间戳:</strong> 该评估表的创建时间。</p>
</li>
</ul>
217
<h2 id="_5">操作信息<a class="headerlink" href="#_5" title="Permanent link">#</a></h2>
218
<p>操作信息字段之间以逗号分割。操作信息与延迟信息之间以制表符分割。</p>
219
<h3 id="conv2d">conv2d<a class="headerlink" href="#conv2d" title="Permanent link">#</a></h3>
220
<p><strong>格式</strong></p>
221
<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>
222
</pre></div>
223
</td></tr></table>
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241

<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>
242
<h3 id="activation">activation<a class="headerlink" href="#activation" title="Permanent link">#</a></h3>
243
<p><strong>格式</strong></p>
244
<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>
245
</pre></div>
246
</td></tr></table>
247 248 249 250 251 252 253 254 255 256

<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>
257
<h3 id="batch_norm">batch_norm<a class="headerlink" href="#batch_norm" title="Permanent link">#</a></h3>
258
<p><strong>格式</strong></p>
259
<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>
260
</pre></div>
261
</td></tr></table>
262 263 264 265

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
266
<li><strong>active_type (string|None)</strong> - 激活函数类型,包含:relu, prelu, sigmoid, relu6, tanh。</li>
267 268 269 270 271 272
<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>
273
<h3 id="eltwise">eltwise<a class="headerlink" href="#eltwise" title="Permanent link">#</a></h3>
274
<p><strong>格式</strong></p>
275
<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>
276
</pre></div>
277
</td></tr></table>
278 279 280 281 282 283 284 285 286 287

<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>
288
<h3 id="pooling">pooling<a class="headerlink" href="#pooling" title="Permanent link">#</a></h3>
289
<p><strong>格式</strong></p>
290
<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>
291
</pre></div>
292
</td></tr></table>
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308

<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>
309
<h3 id="softmax">softmax<a class="headerlink" href="#softmax" title="Permanent link">#</a></h3>
310
<p><strong>格式</strong></p>
311
<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>
312
</pre></div>
313
</td></tr></table>
314 315 316 317 318 319 320 321 322 323

<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>
324 325
</ul>
              
326
            </div>
327 328 329
          </div>
          <footer>
  
330 331
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
332
        <a href="../tutorials/quant_post_demo/" class="btn btn-neutral float-right" title="离线量化">Next <span class="icon icon-circle-arrow-right"></span></a>
333 334 335 336 337 338
      
      
        <a href="../api/search_space/" class="btn btn-neutral" title="搜索空间"><span class="icon icon-circle-arrow-left"></span> Previous</a>
      
    </div>
  
339 340 341 342 343 344 345 346 347 348 349

  <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>
      
350
        </div>
351 352 353 354 355 356 357 358 359
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
360
          <a href="https://github.com/PaddlePaddle/PaddleSlim/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
361 362
      
      
363 364 365
        <span><a href="../api/search_space/" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
366
        <span style="margin-left: 15px"><a href="../tutorials/quant_post_demo/" style="color: #fcfcfc">Next &raquo;</a></span>
367 368
      
    </span>
369
</div>
370 371 372
    <script>var base_url = '..';</script>
    <script src="../js/theme.js" defer></script>
      <script src="../mathjax-config.js" defer></script>
373
      <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
374
      <script src="../search/main.js" defer></script>
375

376
</body>
377
</html>