Skip to content

Commit

Permalink
update getting started doc (#2614)
Browse files Browse the repository at this point in the history
  • Loading branch information
jingxu10 authored Feb 19, 2024
1 parent e321937 commit b08a7f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cpu/2.2.0+cpu/tutorials/getting_started.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h1>Quick Start<a class="headerlink" href="#quick-start" title="Permalink to thi
<p>The example below demostrates how to use the Intel® Extension for PyTorch*:</p>
<section id="generic-model-quick-start">
<h2>Generic Model Quick Start<a class="headerlink" href="#generic-model-quick-start" title="Permalink to this heading"></a></h2>
<p><code class="docutils literal notranslate"><span class="pre">ipex.optimize</span></code> is generally used for generic PyTorch models.</p>
<p><code class="docutils literal notranslate"><span class="pre">ipex.optimize</span></code> coworks with <span class="pre">TorchScript</span>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">torch</span>
<span class="c1">############## import ipex ###############</span>
<span class="kn">import</span> <span class="nn">intel_extension_for_pytorch</span> <span class="k">as</span> <span class="nn">ipex</span>
Expand All @@ -148,6 +148,18 @@ <h2>Generic Model Quick Start<a class="headerlink" href="#generic-model-quick-st
<span class="n">model</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">jit</span><span class="o">.</span><span class="n">freeze</span><span class="p">(</span><span class="n">model</span><span class="p">)</span>
<span class="n">model</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="c1">##########################################</span>
</pre></div>
</div>
<p></p>
<p><code class="docutils literal notranslate"><span class="pre">ipex.optimize</span></code> coworks with <span class="pre">TorchDynamo</span>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">torch</span>
<span class="c1">############## import ipex ###############</span>
<span class="kn">import</span> <span class="nn">intel_extension_for_pytorch</span> <span class="k">as</span> <span class="nn">ipex</span>
<span class="c1">##########################################</span>

<span class="n">model</span> <span class="o">=</span> <span class="n">Model</span><span class="p">()</span>
<span class="n">model</span><span class="o">.</span><span class="n">eval</span><span class="p">()</span>
<span class="n">data</span> <span class="o">=</span> <span class="o">...</span>

<span class="c1">############## TorchDynamo ###############</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">ipex</span><span class="o">.</span><span class="n">optimize</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">weights_prepack</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
Expand Down Expand Up @@ -292,4 +304,4 @@ <h2>LLM Quick Start<a class="headerlink" href="#llm-quick-start" title="Permalin
</script>

</body>
</html>
</html>

0 comments on commit b08a7f5

Please sign in to comment.