Derive macro generating an impl of the trait Hash
.
Asserts that a given configuration is set.
Asserts that types are equal in alignment.
Asserts that types are equal in size.
Asserts that values pointed to are equal in size.
Asserts that values are equal in size.
Asserts that the type has the given fields.
Asserts that the type implements all of the given traits.
Asserts that the type implements any of the given traits.
Asserts that the type implements exactly one in a set of traits.
Asserts that the type does not implement all of the given traits.
Asserts that the type does not implement any of the given traits.
Asserts that the traits support dynamic dispatch
(
object-safety).
Asserts that the trait is a child of all of the other traits.
Asserts that the trait is a parent of all of the other traits.
Asserts that all types in a list are equal to each other.
Asserts that all types are not equal to each other.
The macro used to generate the flag structures.
Asserts that constant expressions evaluate to true
.
Asserts that constants are equal in value.
Asserts that constants are not equal in value.
Define a new Enhanced Enum.
Macro for converting sequence of string literals containing hex-encoded data
into an array of bytes.
| INPUT_TAGS and OUTPUT_TAGS are optional features
| to name the indices of the operator’s inputs and
| outputs, in order to avoid confusion.
|
| For example, for a fully convolution layer that
| has input, weight and bias, you can define its
| input tags as:
|
| INPUT_TAGS(INPUT, WEIGHT, BIAS);
| And in the code, instead of doing
| auto& weight = Input(1);
| you can now do
| auto& weight = Input(WEIGHT);
| to make it more clear.
Macro to generate an implementation of Adapter
for a given set of types.
In particular this will automatically generate implementations of the
get_value
and get_link
methods for a given named field in a struct.
| NO_GRADIENT means that the operator
| does not need any gradient computation.
|
| OP_SINGLE_ARG provides a shorter initialization
| choice for initialization of member
| variables for the class constructors.
|
| This is a workaround for CUDA9.2 and
| GCC7
|
Macros for cudnn since we use it often
| Auxiliary output gradients are currently
| implemented only for Lengths version
|
| This implements and registers a length
| op with a gradient which requires the
| main input as well as the output of the
| forward output.
|
| SHOULD_NOT_DO_GRADIENT means that the operator
| is not designed to have gradient operators. If
| you attempt to call the gradient, a log fatal
| will occur.
2-byte alignment
4-byte alignment
8-byte alignment
16-byte alignment
32-byte alignment
64-byte alignment
A newtype with alignment of at least A
bytes
A thread-safe reference-counting pointer. ‘Arc’ stands for ‘Atomically
Reference Counted’.
| ———–
| @brief
|
| A helper class to index into arguments.
|
| This helper helps us to more easily index
| into a set of arguments that are present
| in the operator.
|
| To save memory, the argument helper
| does not copy the operator def, so one
| would need to make sure that the lifetime
| of the OperatorDef object outlives
| that of the ArgumentHelper.
|
A generic atomic wrapper type which allows an object to be safely shared
between threads.
A boolean type which can be safely shared between threads.
An integer type which can be safely shared between threads.
A raw pointer type which can be safely shared between threads.
An integer type which can be safely shared between threads.
An integer type which can be safely shared between threads.
Exclusive
provides only mutable access, also referred to as exclusive
access to the underlying value. It provides no immutable, or shared
access to the underlying value.
A value which is initialized on the first access.
A value which is initialized on the first access.
A cell which can be written to only once.
A synchronization primitive which can be written to only once.
Implement FromResidual<Yeet<T>>
on your type to enable
do yeet expr
syntax in functions returning your type.
An ordered map based on a
B-Tree.
An ordered set based on a B-Tree.
A barrier enables multiple threads to synchronize the beginning
of some computation.
A priority queue implemented with a binary heap.
The BufReader<R>
struct adds buffering to any reader.
Wraps a writer and buffers its output.
Generated files are compatible only with the same version
of protobuf runtime.
A mutable memory location.
A complex number in Cartesian form.
A Condition Variable
RAII type that represents the Global Interpreter Lock acquisition.
A
hash map implemented with quadratic probing and SIMD lookup.
A
hash set implemented as a
HashMap
where the value is
()
.
An intrusive doubly-linked list.
A doubly-linked list with owned nodes.
Intrusive link that allows an object to be inserted into a
LinkedList
.
Generated files are compatible only with the same version
of protobuf runtime.
A mutual exclusion primitive useful for protecting shared data
An RAII implementation of a “scoped lock” of a mutex. When this structure is
dropped (falls out of scope), the lock will be unlocked.
Generated files are compatible only with the same version
of protobuf runtime.
A synchronization primitive which can be used to run a one-time global
initialization. Useful for one-time initialization for FFI or related
functionality. This type can only be constructed with
Once::new()
.
Zero-sized type used to mark things that “act like” they own a T
.
A type of error which can be returned whenever a lock is acquired.
Generated files are compatible only with the same version
of protobuf runtime.
A GIL-independent reference to an object allocated on the Python heap.
Represents any Python object.
A container type for (mutably) accessing
PyClass
values
Initializer for our #[pyclass]
system.
Represents a Python exception.
Represents a Python
module
object.
A wrapper type for an immutably borrowed value from a
PyCell
<T>
.
A wrapper type for a mutably borrowed value from a
PyCell
<T>
.
A marker token that represents holding the GIL.
A (half-open) range bounded inclusively below and exclusively above
(start..end
).
A range only bounded inclusively below (start..
).
An unbounded range (..
).
A range bounded inclusively below and above (start..=end
).
A range only bounded exclusively above (..end
).
A range only bounded inclusively above (..=end
).
Raw mutex type backed by the parking lot.
A single-threaded reference-counting pointer. ‘Rc’ stands for ‘Reference
Counted’.
Generated files are compatible only with the same version
of protobuf runtime.
Wraps a borrowed reference to a value in a RefCell
box.
A wrapper type for an immutably borrowed value from a RefCell<T>
.
A mutable memory location with dynamically checked borrow rules
A wrapper type for a mutably borrowed value from a RefCell<T>
.
Wrapper around vector to avoid deallocations on clear.
A reader-writer lock
RAII structure used to release the shared read access of a lock when
dropped.
RAII structure used to release the exclusive write access of a lock when
dropped.
An unbounded multi-producer multi-consumer queue.
A Vec
-like container that can store a small number of elements inline.
The standard RNG. This is designed to be efficient on the current
platform.
Generated files are compatible only with the same version
of protobuf runtime.
A handle to a thread.
The error type for try_reserve
methods.
Generated files are compatible only with the same version
of protobuf runtime.
This is a temporary fix for certain types which live in aten or elsewhere
The core primitive for interior mutability in Rust.
A double-ended queue implemented with a growable ring buffer.
A type indicating whether a timed wait on a condition variable returned
due to a time out or not.
A 16-bit floating point type implementing the
bfloat16
format.
A 16-bit floating point type implementing the IEEE 754-2008 standard
binary16
a.k.a
half
format.
Trait that indicates that this is a pointer or a wrapper for one,
where unsizing can be performed on the pointee.
DispatchFromDyn
is used in the implementation of object safety checks (specifically allowing
arbitrary self types), to guarantee that a method’s receiver type can be dispatched on.
The addition operator +
.
The addition assignment operator +=
.
The bitwise AND operator &
.
The bitwise AND assignment operator &=
.
The bitwise OR operator |
.
The bitwise OR assignment operator |=
.
The bitwise XOR operator ^
.
The bitwise XOR assignment operator ^=
.
Generic trait for floating point complex numbers.
Used for immutable dereferencing operations, like *v
.
Used for mutable dereferencing operations, like in *v = 1;
.
The division operator /
.
The division assignment operator /=
.
Custom code within the destructor.
Error
is a trait representing the basic expectations for error values,
i.e., values of type
E
in
Result<T, E>
.
Generic trait for floating point numbers
The version of the call operator that takes an immutable receiver.
The version of the call operator that takes a mutable receiver.
The version of the call operator that takes a by-value receiver.
FromParallelIterator
implements the creation of a collection
from a
ParallelIterator
. By implementing
FromParallelIterator
for a given type, you define how it will be
created from an iterator.
Extract a type from a Python object.
Used to specify which residuals can be converted into which
crate::ops::Try
types.
The trait implemented by builtin generator types.
A hashable type.
A trait for hashing an arbitrary stream of bytes.
Used for indexing operations (container[index]
) in immutable contexts.
Used for indexing operations (container[index]
) in mutable contexts.
An iterator that supports “random access” to its data, meaning
that you can split it at arbitrary indices and draw data from
those points.
IntoParallelRefIterator
implements the conversion to a
ParallelIterator
, providing shared references to the data.
IntoParallelRefMutIterator
implements the conversion to a
ParallelIterator
, providing mutable references to the data.
Defines a conversion from a Rust type to a Python object.
Returns an owned pointer to a Python object.
Support trait for enabling a few common operation on lazy static values.
OneSidedRange
is implemented for built-in range types that are unbounded
on one side. For example, a..
, ..b
and ..=c
implement OneSidedRange
,
but ..
, d..e
, and f..=g
do not.
A trait for dealing with iterators.
The multiplication operator *
.
The multiplication assignment operator *=
.
The unary negation operator -
.
The unary logical negation operator !
.
The base trait for numeric types, covering 0
and 1
values,
comparisons, basic numeric operations, and string conversion.
Conversion trait to convert an Iterator
to a ParallelIterator
.
ParallelDrainFull
creates a parallel iterator that moves all items
from a collection while retaining the original capacity.
ParallelDrainRange
creates a parallel iterator that moves a range of items
from a collection while retaining the original capacity.
ParallelExtend
extends an existing collection with items from a
ParallelIterator
.
Parallel version of the standard iterator trait.
Parallel extensions for slices.
Parallel extensions for mutable slices.
Parallel extensions for strings.
A marker trait indicating that a type is Plain Old Data.
Generic trait for primitive integers.
Trait implemented by Python object types that allow a checked downcast.
If T
implements PyTryFrom
, we can convert &PyAny
to &T
.
Trait implemented by Python object types that allow a checked downcast.
This trait is similar to std::convert::TryInto
Allows retrieving the canonical type implementing
Try
that has this type
as its residual and allows it to hold an
O
as its output.
RangeBounds
is implemented by Rust’s built-in range types, produced
by range syntax like ..
, a..
, ..b
, ..=c
, d..e
, or f..=g
.
The Read
trait allows for reading bytes from a source.
A trait for real number types that do not necessarily have
floating-point-specific characteristics such as NaN and infinity.
The remainder operator %
.
The remainder assignment operator %=
.
The left shift operator <<
. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust’s type
checker has special handling for _ << _
, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though a << b
and a.shl(b)
are one and the same from an evaluation
standpoint, they are different when it comes to type inference.
The left shift assignment operator <<=
.
The right shift operator >>
. Note that because this trait is implemented
for all integer types with multiple right-hand-side types, Rust’s type
checker has special handling for _ >> _
, setting the result type for
integer operations to the type of the left-hand-side operand. This means
that though a >> b
and a.shr(b)
are one and the same from an evaluation
standpoint, they are different when it comes to type inference.
The right shift assignment operator >>=
.
A struct that is converted from command line arguments.
The ?
operator and try {}
blocks.
The subtraction operator -
.
The subtraction assignment operator -=
.
The trait to implement to get setup/teardown functionality for tests.
Conversion trait that allows various objects to be converted into PyObject
.
A trait for objects which are byte-oriented sinks.
Used for immutable dereferencing operations, like *v
.
Changes the alignment of value
to be at least A
bytes
| Caffe2 wrapper functions for protobuf’s
| GetEmptyStringAlreadyInited() function used to
| avoid duplicated global variable in the case
| when protobuf is built with hidden visibility.
| Given a net, modify the external inputs/outputs
| if necessary so that the following conditions
| are met
|
| - No duplicate external inputs
|
| - No duplicate external outputs
|
| - Going through list of ops in order,
| all op inputs must be outputs from other
| ops, or registered as external inputs.
|
| - All external outputs must be outputs
| of some operators.
|
| A simplified version compared to the
| full
|
| CreateOperator, if you do not need to
| specify args.
|
| IterableInputs default = std::initializer_list
|
| IterableOutputs default = std::initializer_list
|
| IterableInputs default = std::initializer_list
|
| IterableOutputs default = std::initializer_list
|
| IterableArgs default = std::initializer_list
|| A wrapper function to return device
| name string for use in blob serialization
| / deserialization.
|
| This should have one to one correspondence
| with caffe2/proto/caffe2.proto:
| enum DeviceType.
|
| ———–
| @note
|
| we can’t use DeviceType_Name, because
| that is only available in protobuf-full,
| and some platforms (like mobile) may
| want to use protobuf-lite instead.
|
| Helper methods to get an argument from
| OperatorDef or NetDef given argument
| name. Throws if argument does not exist.
|
| Return the argument index or -1 if it
| does not exist.
|
| Helper methods to get an argument from
| OperatorDef or NetDef given argument
| name. Returns nullptr if argument does not
| exist.
| Helper methods to query a boolean argument
| flag from OperatorDef or NetDef given
| argument name. If argument does not
| exist, return default value.
|
| Throws if argument exists but the type
| is not boolean.
|
Takes a shared reference to a lazy static and initializes
it if it has not been already.
| Returns if the two DeviceOptions are
| pointing to the same device.
|
| ONNX wrapper functions for protobuf’s
| GetEmptyStringAlreadyInited() function used to
| avoid duplicated global variable in the case
| when protobuf is built with hidden visibility.
| Read Proto from a file, letting the code
| figure out if it is text or binary.
|
| Common interfaces that are supported
| by both lite and full protobuf.
|
| Common interfaces that reads file contents
| into a string.
|
| A wrapper function to shut down protobuf
| library (this is needed in ASAN testing and
| valgrind cases to avoid protobuf appearing to
| “leak” memory).
Returns the size of a type in bytes.
| Helper function to verify that conversion
| between types won’t loose any significant
| bit.
|