diff options
author | Anna R <annarev@google.com> | 2017-11-17 15:20:49 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-11-17 15:27:48 -0800 |
commit | cb12ebe044ad8fb8515bc9d95d27c0ab19ec314b (patch) | |
tree | bfb473429b96efca65ac39a7b0bc0476c7ce1551 /tensorflow/tensorflow.bzl | |
parent | 3cc43816cda27c497399bf94429b174db5ed6d6b (diff) |
Provide an option to use ApiDef instead of OpGenOverrides when generating C++ API. Also, updating UpdateDocs method to ApiDef to replace names in docs.
PiperOrigin-RevId: 176167953
Diffstat (limited to 'tensorflow/tensorflow.bzl')
-rw-r--r-- | tensorflow/tensorflow.bzl | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl index a3ba363469..8d392fb36d 100644 --- a/tensorflow/tensorflow.bzl +++ b/tensorflow/tensorflow.bzl @@ -316,7 +316,9 @@ def tf_gen_op_wrapper_cc(name, op_gen=clean_dep("//tensorflow/cc:cc_op_gen_main"), deps=None, override_file=None, - include_internal_ops=0): + include_internal_ops=0, + # ApiDefs will be loaded in the order specified in this list. + api_def_srcs=[]): # Construct an op generator binary for these ops. tool = out_ops_file + "_gen_cc" if deps == None: @@ -328,12 +330,26 @@ def tf_gen_op_wrapper_cc(name, linkstatic=1, # Faster to link this one-time-use binary dynamically deps=[op_gen] + deps) + srcs = api_def_srcs[:] + if override_file == None: - srcs = [] override_arg = "," else: - srcs = [override_file] + srcs += [override_file] override_arg = "$(location " + override_file + ")" + + if not api_def_srcs: + api_def_args_str = "," + else: + api_def_args = [] + for api_def_src in api_def_srcs: + # Add directory of the first ApiDef source to args. + # We are assuming all ApiDefs in a single api_def_src are in the + # same directory. + api_def_args.append( + " $$(dirname $$(echo $(locations " + api_def_src + + ") | cut -d\" \" -f1))") + api_def_args_str = ",".join(api_def_args) native.genrule( name=name + "_genrule", outs=[ @@ -344,7 +360,7 @@ def tf_gen_op_wrapper_cc(name, tools=[":" + tool] + tf_binary_additional_srcs(), cmd=("$(location :" + tool + ") $(location :" + out_ops_file + ".h) " + "$(location :" + out_ops_file + ".cc) " + override_arg + " " + - str(include_internal_ops))) + str(include_internal_ops) + " " + api_def_args_str)) # Given a list of "op_lib_names" (a list of files in the ops directory @@ -387,7 +403,9 @@ def tf_gen_op_wrappers_cc(name, op_gen=clean_dep("//tensorflow/cc:cc_op_gen_main"), override_file=None, include_internal_ops=0, - visibility=None): + visibility=None, + # ApiDefs will be loaded in the order apecified in this list. + api_def_srcs=[]): subsrcs = other_srcs[:] subhdrs = other_hdrs[:] internalsrcs = [] @@ -399,7 +417,8 @@ def tf_gen_op_wrappers_cc(name, pkg=pkg, op_gen=op_gen, override_file=override_file, - include_internal_ops=include_internal_ops) + include_internal_ops=include_internal_ops, + api_def_srcs=api_def_srcs) subsrcs += ["ops/" + n + ".cc"] subhdrs += ["ops/" + n + ".h"] internalsrcs += ["ops/" + n + "_internal.cc"] |