Skip to main content

tvm_ffi/
lib.rs

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19pub mod any;
20pub mod collections;
21pub mod derive;
22pub mod device;
23pub mod dtype;
24pub mod error;
25pub mod extra;
26pub mod function;
27pub mod function_internal;
28pub mod macros;
29#[doc(hidden)]
30pub mod match_any_internal;
31pub mod object;
32pub mod optional;
33pub mod reflection;
34pub mod rvalue_ref;
35pub mod string;
36pub mod type_traits;
37pub use tvm_ffi_sys;
38
39pub use crate::any::{Any, AnyView};
40pub use crate::collections::array::Array;
41pub use crate::collections::map::Map;
42pub use crate::collections::shape::Shape;
43pub use crate::collections::tensor::{CPUNDAlloc, NDAllocator, Tensor};
44pub use crate::device::{current_stream, with_stream};
45pub use crate::dtype::DLDataTypeExt;
46pub use crate::error::{Error, ErrorKind, Result};
47pub use crate::error::{
48    ATTRIBUTE_ERROR, INDEX_ERROR, KEY_ERROR, RUNTIME_ERROR, TYPE_ERROR, VALUE_ERROR,
49};
50pub use crate::extra::module::Module;
51pub use crate::extra::structural_mutate::{
52    structural_map, structural_mutate, CallbackMutator, InplaceValue, IntoMapResult, IntoMapper,
53    IntoMutator, MapChainLink, MapDispatch, MapValue, MutateCallbacks, MutateChainLink,
54    MutateContext, MutateDispatch, Mutator, StructuralMutator, StructuralVarRemap,
55};
56pub use crate::extra::structural_visit::{
57    structural_visit, structural_walk, DefRegionKind, IntoVisitor, IntoWalkResult, IntoWalker,
58    StructuralVisitor, VisitCallbacks, VisitChainLink, VisitContext, VisitInterrupt, VisitValue,
59    WalkChainLink, WalkDispatch, WalkOrder, WalkResult,
60};
61pub use crate::extra::unchanged::{Unchanged, UnchangedOr};
62pub use crate::function::Function;
63pub use crate::object::ObjectRefCast;
64pub use crate::object::{
65    Object, ObjectArc, ObjectCore, ObjectCoreWithExtraItems, ObjectIdentity, ObjectRefCore,
66};
67pub use crate::optional::{Optional, OptionalCompatible};
68pub use crate::reflection::{get_type_attr, FieldGetter, TypeAttrColumn};
69pub use crate::rvalue_ref::RValueRef;
70pub use crate::string::{Bytes, String};
71pub use crate::type_traits::AnyCompatible;
72pub use tvm_ffi_macros::{dispatch, match_any};
73
74pub use tvm_ffi_sys::TVMFFITypeIndex as TypeIndex;
75pub use tvm_ffi_sys::{
76    DLDataType, DLDataTypeCode, DLDevice, DLDeviceType, TVMFFIAny, TVMFFIObject, TVMFFIStreamHandle,
77};