Skip to content

Commit

Permalink
use long() for casting
Browse files Browse the repository at this point in the history
  • Loading branch information
interesaaat committed Aug 19, 2020
1 parent ade75de commit da72a2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,18 +327,10 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="hummingbird.ml.operator_converters.onnx.onnx_operator.Cast.forward"><code class="name flex">
<span>def <span class="ident">forward</span></span>(<span>self, x)</span>
<span>def <span class="ident">forward</span></span>(<span>self, x) -> Callable[..., Any]</span>
</code></dt>
<dd>
<div class="desc"><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the :class:<code>Module</code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
</div></div>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
Expand Down Expand Up @@ -377,18 +369,10 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="hummingbird.ml.operator_converters.onnx.onnx_operator.Concat.forward"><code class="name flex">
<span>def <span class="ident">forward</span></span>(<span>self, *x)</span>
<span>def <span class="ident">forward</span></span>(<span>self, *x) -> Callable[..., Any]</span>
</code></dt>
<dd>
<div class="desc"><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the :class:<code>Module</code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
</div></div>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
Expand Down Expand Up @@ -429,18 +413,10 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="hummingbird.ml.operator_converters.onnx.onnx_operator.Reshape.forward"><code class="name flex">
<span>def <span class="ident">forward</span></span>(<span>self, x)</span>
<span>def <span class="ident">forward</span></span>(<span>self, x) -> Callable[..., Any]</span>
</code></dt>
<dd>
<div class="desc"><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the :class:<code>Module</code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
</div></div>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
Expand Down
12 changes: 2 additions & 10 deletions doc/html/hummingbird/ml/operator_converters/sklearn/skl_sv.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,18 +304,10 @@ <h3>Ancestors</h3>
<h3>Methods</h3>
<dl>
<dt id="hummingbird.ml.operator_converters.sklearn.skl_sv.SVC.forward"><code class="name flex">
<span>def <span class="ident">forward</span></span>(<span>self, x)</span>
<span>def <span class="ident">forward</span></span>(<span>self, x) -> Callable[..., Any]</span>
</code></dt>
<dd>
<div class="desc"><p>Defines the computation performed at every call.</p>
<p>Should be overridden by all subclasses.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Although the recipe for forward pass needs to be defined within
this function, one should call the :class:<code>Module</code> instance afterwards
instead of this since the former takes care of running the
registered hooks while the latter silently ignores them.</p>
</div></div>
<div class="desc"></div>
<details class="source">
<summary>
<span>Expand source code</span>
Expand Down
3 changes: 1 addition & 2 deletions hummingbird/ml/operator_converters/_tree_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ def forward(self, x):
lefts = torch.index_select(self.lefts, 0, indexes).view(-1, self.num_trees)
rights = torch.index_select(self.rights, 0, indexes).view(-1, self.num_trees)

indexes = torch.where(torch.ge(feature_values, thresholds), rights, lefts)
indexes = indexes.type(torch.LongTensor)
indexes = torch.where(torch.ge(feature_values, thresholds), rights, lefts).long()
indexes = indexes + self.nodes_offset
indexes = indexes.view(-1)

Expand Down

0 comments on commit da72a2a

Please sign in to comment.