package rune
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=a9a8a9787f8250337187bb7b21cb317c41bfd2ecf08bcfe0ab407c7b6660764d
sha512=fe13cf257c487e41efe2967be147d80fa94bac8996d3aab2b8fd16f0bbbd108c15e0e58c025ec9bf294d4a0d220ca2ba00c3b1b42fa2143f758c5f0ee4c15782
doc/rune.metal/Rune_metal/index.html
Module Rune_metal
Source
include Nx_core.Backend_intf.S
Opaque tensor handle.
'a
is the OCaml element type; 'b
tags the dtype.
Backend execution context. Carries any state required by the implementation (memory pools, command queues, ...).
Return the logical view metadata of t
.
Element type of t
.
Return the raw buffer of t
.
Allocate a buffer of size_in_elements
elements of dtype
.
Tensor containing a single scalar value
.
Tensor containing the elements of array
. The array must be contiguous.
Compare <
. Returns 0 or 1 as uint8.
Compare <>
. Returns 0 or 1 as uint8.
Select from if_true
or if_false
based on a boolean tensor.
Sum over axes
. Keeps reduced dimensions if keepdims
is true.
Maximum over axes
. Keeps reduced dimensions if keepdims
is true.
Product over axes
. Keeps reduced dimensions if keepdims
is true.
Broadcast dimensions of size 1 to a new shape.
Change the logical shape without moving data.
Pad with fill_value
using the given configuration.
Slice according to the given start/stop pairs.
Flip dimensions where the boolean array is true
.
Cast elements to target_dtype
.
Store src
into dst
at the given logical indices.
val op_threefry :
(int32, Nx_core.Dtype.int32_elt) t ->
(int32, Nx_core.Dtype.int32_elt) t ->
(int32, Nx_core.Dtype.int32_elt) t
Threefry random number generator.
Gather elements from data
along axis
using indices
. Output shape matches indices
. Ranks of data
and indices
must match. Sizes of indices
dims != axis
must be <= data
corresponding dims.
val op_scatter :
?mode:[ `Set | `Add ] ->
?unique_indices:bool ->
('a, 'b) t ->
(int32, Nx_core.Dtype.int32_elt) t ->
('a, 'b) t ->
int ->
('a, 'b) t
Scatter updates
into a new tensor shaped like data_template
along axis
using indices
. Returns a new tensor.
mode
specifies how to handle duplicate indices:`Set
(default): last update wins`Add
: accumulate updates at duplicate indicesunique_indices
: hint that indices are unique (optimization)
val op_unfold :
('a, 'b) t ->
kernel_size:int array ->
stride:int array ->
dilation:int array ->
padding:(int * int) array ->
('a, 'b) t
Unfold (im2col) operation. Extracts sliding local blocks from a batched input tensor. For an input of shape (N, C, *spatial_dims), produces output of shape (N, C * prod(kernel_size), L) where L is the number of blocks. Works for any number of spatial dimensions.
val op_fold :
('a, 'b) t ->
output_size:int array ->
kernel_size:int array ->
stride:int array ->
dilation:int array ->
padding:(int * int) array ->
('a, 'b) t
Fold (col2im) operation. Combines an array of sliding local blocks into a tensor. For an input of shape (N, C * prod(kernel_size), L), produces output of shape (N, C, *output_size). Inverse of unfold. Overlapping values are summed. Works for any number of spatial dimensions.
Matrix multiplication. For 2D tensors, computes standard matrix multiplication. For higher dimensions, performs batched matrix multiplication on the last two dimensions, broadcasting batch dimensions as needed. The last dimension of the first tensor must match the second-to-last dimension of the second tensor.