Skip to content
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

Import Java operators generator from main repo #2

Merged
merged 1 commit into from
Oct 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 59 additions & 1 deletion tensorflow-core/tensorflow-core-api/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,59 @@
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts")
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts", "tf_cc_binary")
load(":tensorflow-java.bzl", "tf_java_op_gen_srcjar")

tf_java_op_gen_srcjar(
name = "java_op_gen_sources",
api_def_srcs = [
"@org_tensorflow//tensorflow/core/api_def:base_api_def",
":java_api_def",
],
base_package = "org.tensorflow.op",
gen_tool = ":java_op_gen_tool",
)

tf_cc_binary(
name = "java_op_gen_tool",
srcs = [
"src/bazel/op_generator/op_gen_main.cc",
],
copts = tf_copts(),
linkopts = select({
"@org_tensorflow//tensorflow:windows": [],
"//conditions:default": ["-lm"],
}),
linkstatic = 1,
deps = [
":java_op_gen_lib",
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core:lib",
"@org_tensorflow//tensorflow/core:ops",
],
)

cc_library(
name = "java_op_gen_lib",
srcs = [
"src/bazel/op_generator/op_generator.cc",
"src/bazel/op_generator/op_specs.cc",
"src/bazel/op_generator/source_writer.cc",
],
hdrs = [
"src/bazel/op_generator/java_defs.h",
"src/bazel/op_generator/op_generator.h",
"src/bazel/op_generator/op_specs.h",
"src/bazel/op_generator/source_writer.h",
],
copts = tf_copts(),
deps = [
"@org_tensorflow//tensorflow/core:framework",
"@org_tensorflow//tensorflow/core:lib",
"@org_tensorflow//tensorflow/core:op_gen_lib",
"@org_tensorflow//tensorflow/core:protos_all_cc",
"@com_googlesource_code_re2//:re2",
],
)

filegroup(
name = "java_api_def",
srcs = glob(["src/bazel/api_def/*"])
)
6 changes: 4 additions & 2 deletions tensorflow-core/tensorflow-core-api/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "org_tensorflow",
# https://github.com/tensorflow/tensorflow/issues/25213
patches = [":tensorflow-windows.patch"],
patches = [
":tensorflow-windows.patch", # https://github.com/tensorflow/tensorflow/issues/25213
":tensorflow-api-def.patch"
],
patch_args = ["-p1"],
urls = [
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz",
Expand Down
4 changes: 2 additions & 2 deletions tensorflow-core/tensorflow-core-api/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
fi

# Build C API of TensorFlow itself including a target to generate ops for Java
bazel build $BUILD_FLAGS --python_path="$PYTHON_BIN_PATH" --config=monolithic --config=mkl --output_filter=DONT_MATCH_ANYTHING --verbose_failures @org_tensorflow//tensorflow:tensorflow @org_tensorflow//tensorflow/java:tensorflow
bazel build $BUILD_FLAGS --python_path="$PYTHON_BIN_PATH" --config=monolithic --config=mkl --output_filter=DONT_MATCH_ANYTHING --verbose_failures @org_tensorflow//tensorflow:tensorflow :java_op_gen_sources

# Normalize some paths with symbolic links
TENSORFLOW_SO=(bazel-bin/external/org_tensorflow/tensorflow/libtensorflow.so.?.?.?)
Expand All @@ -38,4 +38,4 @@ fi

# Copy only main generated Java source files for ops
mkdir -p src/gen/java/
cp -r bazel-genfiles/external/org_tensorflow/tensorflow/java/ops/src/main/java/* src/gen/java/
cp -r bazel-genfiles/ops/src/* src/gen/java/
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/tensorflow/core/api_def/BUILD b/tensorflow/core/api_def/BUILD
index f96645ad9f..63f94d3b87 100644
--- a/tensorflow/core/api_def/BUILD
+++ b/tensorflow/core/api_def/BUILD
@@ -28,7 +28,7 @@ package(
filegroup(
name = "base_api_def",
srcs = glob(["base_api/*"]),
- visibility = ["//tensorflow:internal"],
+ visibility = ["//visibility:public"],
)

filegroup(
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
op {
graph_op_name: "Abort"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Abs"
endpoint {
name: "math.Abs"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AccumulateNV2"
endpoint {
name: "math.AccumulateN"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AccumulatorApplyGradient"
endpoint {
name: "train.AccumulatorApplyGradient"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AccumulatorNumAccumulated"
endpoint {
name: "train.AccumulatorNumAccumulated"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AccumulatorSetGlobalStep"
endpoint {
name: "train.AccumulatorSetGlobalStep"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AccumulatorTakeGradient"
endpoint {
name: "train.AccumulatorTakeGradient"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Acos"
endpoint {
name: "math.Acos"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Acosh"
endpoint {
name: "math.Acosh"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Add"
endpoint {
name: "math.Add"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AddManySparseToTensorsMap"
endpoint {
name: "sparse.AddManySparseToTensorsMap"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AddN"
endpoint {
name: "math.AddN"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AddSparseToTensorsMap"
endpoint {
name: "sparse.AddSparseToTensorsMap"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
op {
graph_op_name: "AddV2"
visibility: SKIP
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
op {
graph_op_name: "AdjustContrast"
visibility: SKIP
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AdjustContrastv2"
endpoint {
name: "image.AdjustContrast"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AdjustHue"
endpoint {
name: "image.AdjustHue"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AdjustSaturation"
endpoint {
name: "image.AdjustSaturation"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
op {
graph_op_name: "All"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AllCandidateSampler"
endpoint {
name: "random.AllCandidateSampler"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Angle"
endpoint {
name: "math.Angle"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AnonymousIterator"
endpoint {
name: "data.AnonymousIterator"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
op {
graph_op_name: "Any"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAdaMax"
endpoint {
name: "train.ApplyAdaMax"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAdadelta"
endpoint {
name: "train.ApplyAdadelta"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAdagrad"
endpoint {
name: "train.ApplyAdagrad"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAdagradDA"
endpoint {
name: "train.ApplyAdagradDa"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAdam"
endpoint {
name: "train.ApplyAdam"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyAddSign"
endpoint {
name: "train.ApplyAddSign"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyCenteredRMSProp"
endpoint {
name: "train.ApplyCenteredRmsProp"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
op {
graph_op_name: "ApplyFtrl"
visibility: SKIP
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyFtrlV2"
endpoint {
name: "train.ApplyFtrl"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyGradientDescent"
endpoint {
name: "train.ApplyGradientDescent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyMomentum"
endpoint {
name: "train.ApplyMomentum"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyPowerSign"
endpoint {
name: "train.ApplyPowerSign"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyProximalAdagrad"
endpoint {
name: "train.ApplyProximalAdagrad"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyProximalGradientDescent"
endpoint {
name: "train.ApplyProximalGradientDescent"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApplyRMSProp"
endpoint {
name: "train.ApplyRmsProp"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ApproximateEqual"
endpoint {
name: "math.ApproximateEqual"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ArgMax"
endpoint {
name: "math.ArgMax"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "ArgMin"
endpoint {
name: "math.ArgMin"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "AsString"
endpoint {
name: "dtypes.AsString"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Asin"
endpoint {
name: "math.Asin"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
op {
graph_op_name: "Asinh"
endpoint {
name: "math.Asinh"
}
}
Loading