-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tensorflow pluggable device #387
Open
Apurer
wants to merge
9
commits into
tensorflow:master
Choose a base branch
from
Apurer:feature/experimental
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a6f9aa2
Tensorflow pluggable device
Apurer 8becc29
delete lib handle
Apurer 481a65a
install dependencies for macOS
Apurer 8b81586
run plugable device test for macOS
Apurer 6f6cf2c
sync with master
Apurer 392e1d3
add quotation mark
Apurer 9a61696
fix dependency name
Apurer 8e2567c
crate fix
Apurer bccf287
system_version_compat=0
Apurer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
[package] | ||
name = "tensorflow" | ||
version = "0.20.0" | ||
authors = ["Adam Crume <[email protected]>"] | ||
authors = [ | ||
"Adam Crume <[email protected]>", | ||
"Maciej Maślanka <[email protected]>" | ||
] | ||
description = "Rust language bindings for TensorFlow." | ||
license = "Apache-2.0" | ||
keywords = ["TensorFlow", "bindings"] | ||
|
@@ -44,6 +47,7 @@ tensorflow_gpu = ["tensorflow-sys/tensorflow_gpu"] | |
tensorflow_unstable = [] | ||
tensorflow_runtime_linking = ["tensorflow-sys-runtime"] | ||
eager = ["tensorflow-sys/eager"] | ||
experimental = ["tensorflow-sys/experimental"] | ||
# This is for testing purposes; users should not use this. | ||
examples_system_alloc = ["tensorflow-sys/examples_system_alloc"] | ||
private-docs-rs = ["tensorflow-sys/private-docs-rs"] # DO NOT RELY ON THIS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ license = "Apache-2.0" | |
authors = [ | ||
"Adam Crume <[email protected]>", | ||
"Ivan Ukhov <[email protected]>", | ||
"Maciej Maślanka <[email protected]>", | ||
] | ||
description = "The package provides bindings to TensorFlow." | ||
documentation = "https://tensorflow.github.io/rust" | ||
|
@@ -36,6 +37,7 @@ zip = "0.6.4" | |
[features] | ||
tensorflow_gpu = [] | ||
eager = [] | ||
experimental = [] | ||
# This is for testing purposes; users should not use this. | ||
examples_system_alloc = [] | ||
private-docs-rs = [] # DO NOT RELY ON THIS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use crate::{TF_DataType, TF_Library, TF_Status}; | ||
|
||
include!("c_api.rs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't render properly (https://github.com/Apurer/rust/tree/feature/experimental/tensorflow-sys). It also needs some explanation. Do users need to follow that link and do anything specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix the rendering issue. Yes, users need to click on the provided link to set up the TensorFlow plugin on Apple computers. I considered including the steps listed on developer.apple.com, but I was unsure if the steps would be updated.