Skip to content

Commit 02d0403

Browse files
authored
Merge pull request #2 from karllessard/operator-generator
Import Java operators generator from main repo
2 parents 83b7ba2 + 5913a9c commit 02d0403

File tree

1,006 files changed

+7364
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,006 files changed

+7364
-5
lines changed
+59-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,59 @@
1-
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts")
1+
load("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_copts", "tf_cc_binary")
2+
load(":tensorflow-java.bzl", "tf_java_op_gen_srcjar")
3+
4+
tf_java_op_gen_srcjar(
5+
name = "java_op_gen_sources",
6+
api_def_srcs = [
7+
"@org_tensorflow//tensorflow/core/api_def:base_api_def",
8+
":java_api_def",
9+
],
10+
base_package = "org.tensorflow.op",
11+
gen_tool = ":java_op_gen_tool",
12+
)
13+
14+
tf_cc_binary(
15+
name = "java_op_gen_tool",
16+
srcs = [
17+
"src/bazel/op_generator/op_gen_main.cc",
18+
],
19+
copts = tf_copts(),
20+
linkopts = select({
21+
"@org_tensorflow//tensorflow:windows": [],
22+
"//conditions:default": ["-lm"],
23+
}),
24+
linkstatic = 1,
25+
deps = [
26+
":java_op_gen_lib",
27+
"@org_tensorflow//tensorflow/core:framework",
28+
"@org_tensorflow//tensorflow/core:lib",
29+
"@org_tensorflow//tensorflow/core:ops",
30+
],
31+
)
32+
33+
cc_library(
34+
name = "java_op_gen_lib",
35+
srcs = [
36+
"src/bazel/op_generator/op_generator.cc",
37+
"src/bazel/op_generator/op_specs.cc",
38+
"src/bazel/op_generator/source_writer.cc",
39+
],
40+
hdrs = [
41+
"src/bazel/op_generator/java_defs.h",
42+
"src/bazel/op_generator/op_generator.h",
43+
"src/bazel/op_generator/op_specs.h",
44+
"src/bazel/op_generator/source_writer.h",
45+
],
46+
copts = tf_copts(),
47+
deps = [
48+
"@org_tensorflow//tensorflow/core:framework",
49+
"@org_tensorflow//tensorflow/core:lib",
50+
"@org_tensorflow//tensorflow/core:op_gen_lib",
51+
"@org_tensorflow//tensorflow/core:protos_all_cc",
52+
"@com_googlesource_code_re2//:re2",
53+
],
54+
)
55+
56+
filegroup(
57+
name = "java_api_def",
58+
srcs = glob(["src/bazel/api_def/*"])
59+
)

tensorflow-core/tensorflow-core-api/WORKSPACE

+4-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
99

1010
http_archive(
1111
name = "org_tensorflow",
12-
# https://github.com/tensorflow/tensorflow/issues/25213
13-
patches = [":tensorflow-windows.patch"],
12+
patches = [
13+
":tensorflow-windows.patch", # https://github.com/tensorflow/tensorflow/issues/25213
14+
":tensorflow-api-def.patch"
15+
],
1416
patch_args = ["-p1"],
1517
urls = [
1618
"https://mirror.bazel.build/github.com/tensorflow/tensorflow/archive/v2.0.0.tar.gz",

tensorflow-core/tensorflow-core-api/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ else
1818
fi
1919

2020
# Build C API of TensorFlow itself including a target to generate ops for Java
21-
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
21+
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
2222

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

3939
# Copy only main generated Java source files for ops
4040
mkdir -p src/gen/java/
41-
cp -r bazel-genfiles/external/org_tensorflow/tensorflow/java/ops/src/main/java/* src/gen/java/
41+
cp -r bazel-genfiles/ops/src/* src/gen/java/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/tensorflow/core/api_def/BUILD b/tensorflow/core/api_def/BUILD
2+
index f96645ad9f..63f94d3b87 100644
3+
--- a/tensorflow/core/api_def/BUILD
4+
+++ b/tensorflow/core/api_def/BUILD
5+
@@ -28,7 +28,7 @@ package(
6+
filegroup(
7+
name = "base_api_def",
8+
srcs = glob(["base_api/*"]),
9+
- visibility = ["//tensorflow:internal"],
10+
+ visibility = ["//visibility:public"],
11+
)
12+
13+
filegroup(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
op {
2+
graph_op_name: "Abort"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Abs"
3+
endpoint {
4+
name: "math.Abs"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AccumulateNV2"
3+
endpoint {
4+
name: "math.AccumulateN"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AccumulatorApplyGradient"
3+
endpoint {
4+
name: "train.AccumulatorApplyGradient"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AccumulatorNumAccumulated"
3+
endpoint {
4+
name: "train.AccumulatorNumAccumulated"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AccumulatorSetGlobalStep"
3+
endpoint {
4+
name: "train.AccumulatorSetGlobalStep"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AccumulatorTakeGradient"
3+
endpoint {
4+
name: "train.AccumulatorTakeGradient"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Acos"
3+
endpoint {
4+
name: "math.Acos"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Acosh"
3+
endpoint {
4+
name: "math.Acosh"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Add"
3+
endpoint {
4+
name: "math.Add"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AddManySparseToTensorsMap"
3+
endpoint {
4+
name: "sparse.AddManySparseToTensorsMap"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AddN"
3+
endpoint {
4+
name: "math.AddN"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AddSparseToTensorsMap"
3+
endpoint {
4+
name: "sparse.AddSparseToTensorsMap"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
op {
2+
graph_op_name: "AddV2"
3+
visibility: SKIP
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
op {
2+
graph_op_name: "AdjustContrast"
3+
visibility: SKIP
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AdjustContrastv2"
3+
endpoint {
4+
name: "image.AdjustContrast"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AdjustHue"
3+
endpoint {
4+
name: "image.AdjustHue"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AdjustSaturation"
3+
endpoint {
4+
name: "image.AdjustSaturation"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
op {
2+
graph_op_name: "All"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AllCandidateSampler"
3+
endpoint {
4+
name: "random.AllCandidateSampler"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Angle"
3+
endpoint {
4+
name: "math.Angle"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AnonymousIterator"
3+
endpoint {
4+
name: "data.AnonymousIterator"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
op {
2+
graph_op_name: "Any"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAdaMax"
3+
endpoint {
4+
name: "train.ApplyAdaMax"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAdadelta"
3+
endpoint {
4+
name: "train.ApplyAdadelta"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAdagrad"
3+
endpoint {
4+
name: "train.ApplyAdagrad"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAdagradDA"
3+
endpoint {
4+
name: "train.ApplyAdagradDa"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAdam"
3+
endpoint {
4+
name: "train.ApplyAdam"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyAddSign"
3+
endpoint {
4+
name: "train.ApplyAddSign"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyCenteredRMSProp"
3+
endpoint {
4+
name: "train.ApplyCenteredRmsProp"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
op {
2+
graph_op_name: "ApplyFtrl"
3+
visibility: SKIP
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyFtrlV2"
3+
endpoint {
4+
name: "train.ApplyFtrl"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyGradientDescent"
3+
endpoint {
4+
name: "train.ApplyGradientDescent"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyMomentum"
3+
endpoint {
4+
name: "train.ApplyMomentum"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyPowerSign"
3+
endpoint {
4+
name: "train.ApplyPowerSign"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyProximalAdagrad"
3+
endpoint {
4+
name: "train.ApplyProximalAdagrad"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyProximalGradientDescent"
3+
endpoint {
4+
name: "train.ApplyProximalGradientDescent"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApplyRMSProp"
3+
endpoint {
4+
name: "train.ApplyRmsProp"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ApproximateEqual"
3+
endpoint {
4+
name: "math.ApproximateEqual"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ArgMax"
3+
endpoint {
4+
name: "math.ArgMax"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "ArgMin"
3+
endpoint {
4+
name: "math.ArgMin"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "AsString"
3+
endpoint {
4+
name: "dtypes.AsString"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Asin"
3+
endpoint {
4+
name: "math.Asin"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
op {
2+
graph_op_name: "Asinh"
3+
endpoint {
4+
name: "math.Asinh"
5+
}
6+
}

0 commit comments

Comments
 (0)