Skip to content

Commit

Permalink
Merge pull request #328 from dskkato/tensorflow-sys/expose_eager_api
Browse files Browse the repository at this point in the history
[tensorflow-sys] Expose the eager API.
  • Loading branch information
adamcrume authored Nov 12, 2021
2 parents 1e4567d + 34815b5 commit dc8c97d
Show file tree
Hide file tree
Showing 9 changed files with 2,597 additions and 4,819 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ image = "0.23.14"
[features]
tensorflow_gpu = ["tensorflow-sys/tensorflow_gpu"]
tensorflow_unstable = []
eager = ["tensorflow-sys/eager"]
# This is for testing purposes; users should not use this.
examples_system_alloc = ["tensorflow-sys/examples_system_alloc"]
private-docs-rs = [] # DO NOT RELY ON THIS
Expand Down
1 change: 1 addition & 0 deletions tensorflow-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ zip = "0.5.13"

[features]
tensorflow_gpu = []
eager = []
# This is for testing purposes; users should not use this.
examples_system_alloc = []
private-docs-rs = [] # DO NOT RELY ON THIS
12 changes: 7 additions & 5 deletions tensorflow-sys/generate_bindgen_rs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ if ! which bindgen > /dev/null; then
exit 1
fi

# See https://github.com/servo/rust-bindgen/issues/550 as to why
# this is blacklisted.
bindgen_options="--blacklist-type max_align_t --size_t-is-usize --default-enum-style=rust --generate-inline-functions"
# TODO: revert
include_dir="$HOME/git/tensorflow"

cmd="bindgen ${bindgen_options} ${include_dir}/tensorflow/c/c_api.h --output src/bindgen.rs -- -I ${include_dir}"
bindgen_options_c_api="--allowlist-function TF_.+ --allowlist-type TF_.+ --allowlist-var TF_.+ --size_t-is-usize --default-enum-style=rust --generate-inline-functions"
cmd="bindgen ${bindgen_options_c_api} ${include_dir}/tensorflow/c/c_api.h --output src/c_api.rs -- -I ${include_dir}"
echo ${cmd}
${cmd}

bindgen_options_eager="--allowlist-function TFE_.+ --allowlist-type TFE_.+ --allowlist-var TFE_.+ --blocklist-type TF_.+ --size_t-is-usize --default-enum-style=rust --generate-inline-functions"
cmd="bindgen ${bindgen_options_eager} ${include_dir}/tensorflow/c/eager/c_api.h --output src/eager/c_api.rs -- -I ${include_dir}"
echo ${cmd}
${cmd}
Loading

0 comments on commit dc8c97d

Please sign in to comment.