ExTorch.Native.BindingDeclaration
(extorch v0.2.0)
Copy Markdown
Conveniences for declaring native calls to a library in Rustler.
This module can be use-d into a module in order to declare
a set of native functions:
defmodule NativeCalls do
use ExTorch.Native.BindingDeclaration
defbindings(:doc_section) do
@doc """
Get the size of a tensor.
## Arguments
- `tensor`: Input tensor
"""
@spec size(ExTorch.Tensor.t()) :: tuple()
defbinding(size(tensor))
end
endBinding behaviour
Internally, ExTorch.Native.BindingDeclaration implements the following
macros:
__using__/0: Enables the module to be used on a module that usesRustlerin order to define the stub definitions for the native functions to call.defmodule NativeExtension do use NativeCalls use Rustler, otp_app: :app_name, crate: "crate_name" end