This repository was archived by the owner on Mar 17, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 436
Expand file tree
/
Copy pathc_api.rs
More file actions
113 lines (112 loc) · 3.03 KB
/
c_api.rs
File metadata and controls
113 lines (112 loc) · 3.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* automatically generated by rust-bindgen 0.61.0 */
#[repr(C)]
#[derive(Debug)]
pub struct TF_CheckpointReader {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug)]
pub struct TF_AttrBuilder {
_unused: [u8; 0],
}
#[repr(C)]
pub struct TF_ShapeAndType {
pub num_dims: ::std::os::raw::c_int,
pub dims: *mut i64,
pub dtype: TF_DataType,
}
#[test]
fn bindgen_test_layout_TF_ShapeAndType() {
const UNINIT: ::std::mem::MaybeUninit<TF_ShapeAndType> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<TF_ShapeAndType>(),
24usize,
concat!("Size of: ", stringify!(TF_ShapeAndType))
);
assert_eq!(
::std::mem::align_of::<TF_ShapeAndType>(),
8usize,
concat!("Alignment of ", stringify!(TF_ShapeAndType))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).num_dims) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(TF_ShapeAndType),
"::",
stringify!(num_dims)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dims) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(TF_ShapeAndType),
"::",
stringify!(dims)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).dtype) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(TF_ShapeAndType),
"::",
stringify!(dtype)
)
);
}
#[repr(C)]
#[derive(Debug)]
pub struct TF_ShapeAndTypeList {
pub num_items: ::std::os::raw::c_int,
pub items: *mut TF_ShapeAndType,
}
#[test]
fn bindgen_test_layout_TF_ShapeAndTypeList() {
const UNINIT: ::std::mem::MaybeUninit<TF_ShapeAndTypeList> = ::std::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::std::mem::size_of::<TF_ShapeAndTypeList>(),
16usize,
concat!("Size of: ", stringify!(TF_ShapeAndTypeList))
);
assert_eq!(
::std::mem::align_of::<TF_ShapeAndTypeList>(),
8usize,
concat!("Alignment of ", stringify!(TF_ShapeAndTypeList))
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).num_items) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(TF_ShapeAndTypeList),
"::",
stringify!(num_items)
)
);
assert_eq!(
unsafe { ::std::ptr::addr_of!((*ptr).items) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(TF_ShapeAndTypeList),
"::",
stringify!(items)
)
);
}
extern "C" {
pub fn TF_LoadPluggableDeviceLibrary(
library_filename: *const ::std::os::raw::c_char,
status: *mut TF_Status,
) -> *mut TF_Library;
}
extern "C" {
pub fn TF_DeletePluggableDeviceLibraryHandle(lib_handle: *mut TF_Library);
}