Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46aaed6

Browse files
committed
Add attention block about types
1 parent c0aa1a9 commit 46aaed6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

advanced_source/torch_script_custom_ops.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ in Python). The return type of our ``warp_perspective`` function will also be a
8585
allocate and initialize new tensor objects in C++ (not required for this
8686
operator).
8787

88+
.. attention::
89+
90+
The TorchScript compiler understands a fixed number of types. Only these types
91+
can be used as arguments to your custom operator. Currently these types are:
92+
``torch::Tensor``, ``torch::Scalar``, ``double``, ``int64_t`` and
93+
``std::vector``s of these types. Note that __only__ ``double`` and __not__
94+
``float``, and __only__ ``int64_t`` and __not__ other integral types such as
95+
``int``, ``short`` or ``long`` are supported.
96+
8897
Inside of our function, the first thing we need to do is convert our PyTorch
8998
tensors to OpenCV matrices, as OpenCV's ``warpPerspective`` expects ``cv::Mat``
9099
objects as inputs. Fortunately, there is a way to do this **without copying

0 commit comments

Comments
 (0)