index.html 17.8 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 59 60 61 62
    <a class="" href="../model_zoo/">模型库</a>
	    </li>
          
            <li class="toctree-l1">
		
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
    <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">
		
90
    <span class="caption-text">API</span>
91
    <ul class="subnav">
92
                <li class="">
93
                    
94
    <a class="" href="../api/quantization_api/">量化</a>
95
                </li>
96
                <li class="">
97
                    
98
    <a class="" href="../api/prune_api/">剪枝与敏感度</a>
99
                </li>
100
                <li class="">
101
                    
102
    <a class="" href="../api/analysis_api/">模型分析</a>
103
                </li>
104
                <li class="">
105
                    
106
    <a class="" href="../api/single_distiller_api/">知识蒸馏</a>
107
                </li>
108
                <li class="">
109
                    
110
    <a class="" href="../api/nas_api/">SA搜索</a>
111
                </li>
112 113
                <li class="">
                    
114
    <a class="" href="../api/search_space.md">搜索空间</a>
115
                </li>
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
                <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>
138 139 140
    </ul>
	    </li>
          
141 142 143 144 145
            <li class="toctree-l1">
		
    <a class="" href="../algo/algo/">算法原理</a>
	    </li>
          
146 147 148 149
        </ul>
      </div>
      &nbsp;
    </nav>
150

151
    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
152

153 154 155
      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
156
        <a href="..">PaddleSlim Docs</a>
157
      </nav>
158

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

<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>
232
<h3 id="activation">activation<a class="headerlink" href="#activation" title="Permanent link">#</a></h3>
233
<p><strong>格式</strong></p>
234
<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>
235
</pre></div>
236
</td></tr></table>
237 238 239 240 241 242 243 244 245 246

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

<p><strong>字段解释</strong></p>
<ul>
<li><strong>op_type(str)</strong> - 当前op类型。</li>
256
<li><strong>active_type (string|None)</strong> - 激活函数类型,包含:relu, prelu, sigmoid, relu6, tanh。</li>
257 258 259 260 261 262
<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>
263
<h3 id="eltwise">eltwise<a class="headerlink" href="#eltwise" title="Permanent link">#</a></h3>
264
<p><strong>格式</strong></p>
265
<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>
266
</pre></div>
267
</td></tr></table>
268 269 270 271 272 273 274 275 276 277

<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>
278
<h3 id="pooling">pooling<a class="headerlink" href="#pooling" title="Permanent link">#</a></h3>
279
<p><strong>格式</strong></p>
280
<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>
281
</pre></div>
282
</td></tr></table>
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298

<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>
299
<h3 id="softmax">softmax<a class="headerlink" href="#softmax" title="Permanent link">#</a></h3>
300
<p><strong>格式</strong></p>
301
<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>
302
</pre></div>
303
</td></tr></table>
304 305 306 307 308 309 310 311 312 313

<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>
314 315
</ul>
              
316
            </div>
317 318 319
          </div>
          <footer>
  
320 321
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
322
        <a href="../algo/algo/" class="btn btn-neutral float-right" title="算法原理">Next <span class="icon icon-circle-arrow-right"></span></a>
323 324
      
      
325
        <a href="../api/nas_api/" class="btn btn-neutral" title="SA搜索"><span class="icon icon-circle-arrow-left"></span> Previous</a>
326 327 328
      
    </div>
  
329 330 331 332 333 334 335 336 337 338 339

  <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>
      
340
        </div>
341 342 343 344 345 346 347 348 349
      </div>

    </section>

  </div>

  <div class="rst-versions" role="note" style="cursor: pointer">
    <span class="rst-current-version" data-toggle="rst-current-version">
      
350
          <a href="https://github.com/PaddlePaddle/PaddleSlim/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
351 352
      
      
353
        <span><a href="../api/nas_api/" style="color: #fcfcfc;">&laquo; Previous</a></span>
354 355
      
      
356
        <span style="margin-left: 15px"><a href="../algo/algo/" style="color: #fcfcfc">Next &raquo;</a></span>
357 358
      
    </span>
359
</div>
360 361 362
    <script>var base_url = '..';</script>
    <script src="../js/theme.js" defer></script>
      <script src="../mathjax-config.js" defer></script>
363
      <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML" defer></script>
364
      <script src="../search/main.js" defer></script>
365

366
</body>
367
</html>