Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 30, 2024
1 parent 34dff7f commit e50acae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions develop/_modules/openvino_xai/common/utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,8 @@ <h1>Source code for openvino_xai.common.utils</h1><div class="highlight"><pre>

<div class="viewcode-block" id="scaling">
<a class="viewcode-back" href="../../../api-manual.html#openvino_xai.common.scaling">[docs]</a>
<span class="k">def</span> <span class="nf">scaling</span><span class="p">(</span><span class="n">saliency_map</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">cast_to_uint8</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Scaling saliency maps to [0, 255] range.&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">scaling</span><span class="p">(</span><span class="n">saliency_map</span><span class="p">:</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">,</span> <span class="n">cast_to_uint8</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">,</span> <span class="n">max_value</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">255</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Scaling saliency maps to [0, max_value] range.&quot;&quot;&quot;</span>
<span class="n">original_num_dims</span> <span class="o">=</span> <span class="n">saliency_map</span><span class="o">.</span><span class="n">ndim</span>
<span class="k">if</span> <span class="n">original_num_dims</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="c1"># If input map is 2D array, add dim so that below code would work</span>
Expand All @@ -471,7 +471,7 @@ <h1>Source code for openvino_xai.common.utils</h1><div class="highlight"><pre>
<span class="n">saliency_map</span> <span class="o">=</span> <span class="n">saliency_map</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="n">num_maps</span><span class="p">,</span> <span class="n">h</span> <span class="o">*</span> <span class="n">w</span><span class="p">))</span>

<span class="n">min_values</span><span class="p">,</span> <span class="n">max_values</span> <span class="o">=</span> <span class="n">get_min_max</span><span class="p">(</span><span class="n">saliency_map</span><span class="p">)</span>
<span class="n">saliency_map</span> <span class="o">=</span> <span class="mi">255</span> <span class="o">*</span> <span class="p">(</span><span class="n">saliency_map</span> <span class="o">-</span> <span class="n">min_values</span><span class="p">[:,</span> <span class="kc">None</span><span class="p">])</span> <span class="o">/</span> <span class="p">(</span><span class="n">max_values</span> <span class="o">-</span> <span class="n">min_values</span> <span class="o">+</span> <span class="mf">1e-12</span><span class="p">)[:,</span> <span class="kc">None</span><span class="p">]</span>
<span class="n">saliency_map</span> <span class="o">=</span> <span class="n">max_value</span> <span class="o">*</span> <span class="p">(</span><span class="n">saliency_map</span> <span class="o">-</span> <span class="n">min_values</span><span class="p">[:,</span> <span class="kc">None</span><span class="p">])</span> <span class="o">/</span> <span class="p">(</span><span class="n">max_values</span> <span class="o">-</span> <span class="n">min_values</span> <span class="o">+</span> <span class="mf">1e-12</span><span class="p">)[:,</span> <span class="kc">None</span><span class="p">]</span>
<span class="n">saliency_map</span> <span class="o">=</span> <span class="n">saliency_map</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">num_maps</span><span class="p">,</span> <span class="n">h</span><span class="p">,</span> <span class="n">w</span><span class="p">)</span>

<span class="k">if</span> <span class="n">original_num_dims</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
Expand Down
4 changes: 2 additions & 2 deletions develop/api-manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ <h2>Common<a class="headerlink" href="#common" title="Link to this heading">#</a

<dl class="py function">
<dt class="sig sig-object py" id="openvino_xai.common.scaling">
<span class="sig-prename descclassname"><span class="pre">openvino_xai.common.</span></span><span class="sig-name descname"><span class="pre">scaling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">saliency_map</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.1)"><span class="pre">ndarray</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">cast_to_uint8</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.12)"><span class="pre">bool</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.1)"><span class="pre">ndarray</span></a></span></span><a class="reference internal" href="_modules/openvino_xai/common/utils.html#scaling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#openvino_xai.common.scaling" title="Link to this definition">#</a></dt>
<dd><p>Scaling saliency maps to [0, 255] range.</p>
<span class="sig-prename descclassname"><span class="pre">openvino_xai.common.</span></span><span class="sig-name descname"><span class="pre">scaling</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">saliency_map</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.1)"><span class="pre">ndarray</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">cast_to_uint8</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.12)"><span class="pre">bool</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_value</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.12)"><span class="pre">int</span></a></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">255</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference external" href="https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray" title="(in NumPy v2.1)"><span class="pre">ndarray</span></a></span></span><a class="reference internal" href="_modules/openvino_xai/common/utils.html#scaling"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#openvino_xai.common.scaling" title="Link to this definition">#</a></dt>
<dd><p>Scaling saliency maps to [0, max_value] range.</p>
</dd></dl>

</section>
Expand Down
Loading

0 comments on commit e50acae

Please sign in to comment.