Skip to content

Commit 1663cf9

Browse files
committed
Add note about code generation
Signed-off-by: Ryan Nett <[email protected]>
1 parent 9188d29 commit 1663cf9

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,21 @@ It can be included in [IntelliJ](https://github.com/google/styleguide/blob/gh-pa
3737
[Eclipse](https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml).
3838
[Google's C++ style guide](https://google.github.io/styleguide/cppguide.html) should also be used for C++ code.
3939

40+
### Code generation
41+
42+
Code generation for `Ops` and related classes is done during `tensorflow-core-api`'s `install`, using the annotation processor in
43+
`tensorflow-core-generator`. If you change or add any operator classes (annotated with `org.tensorflow.op.annotation.Operator`),
44+
endpoint methods (annotated with `org.tensorflow.op.annotation.Endpoint`), or change the annotation processor, be sure to re-run a
45+
full `mvn install` in `tensorflow-core-api`.
46+
4047
### Working with Bazel generation
4148

42-
`tensorflow-core-api` uses C++ code generation that is built with Bazel. To get it to build, you will likely need to clone the
43-
`tensorflow` project, run its configuration script (`./configure`), and copy the resulting `.tf_configure.bazelrc` to `tensorflow-core-api`.
49+
`tensorflow-core-api` uses Bazel-built C++ code generation to generate most of the `@Operator` classes. To get it to build, you will likely need to
50+
clone the [tensorflow](https://github.com/tensorflow/tensorflow) project, run its configuration script (`./configure`), and copy the resulting
51+
`.tf_configure.bazelrc` to `tensorflow-core-api`.
4452

4553
To run the code generation, use the `//:java_op_generator` target. The resulting binary has good help text (viewable in
4654
[op_gen_main.cc](tensorflow-core/tensorflow-core-api/src/bazel/op_generator/op_gen_main.cc#L31-L48)).
47-
Generally, it should be called with arguments that are something like `bazel-out/k8-opt/bin/external/org_tensorflow/tensorflow/libtensorflow_cc.so
55+
Genrally, it should be called with arguments that are something like `bazel-out/k8-opt/bin/external/org_tensorflow/tensorflow/libtensorflow_cc.so
4856
--output_dir=src/gen/java --api_dirs=bazel-tensorflow-core-api/external/org_tensorflow/tensorflow/core/api_def/base_api,src/bazel/api_def`
4957
(from `tensorflow-core-api`).

0 commit comments

Comments
 (0)