1*14675a02SAndroid Build Coastguard Worker# Copyright 2019 Google LLC 2*14675a02SAndroid Build Coastguard Worker# 3*14675a02SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*14675a02SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*14675a02SAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*14675a02SAndroid Build Coastguard Worker# 7*14675a02SAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 8*14675a02SAndroid Build Coastguard Worker# 9*14675a02SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*14675a02SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*14675a02SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*14675a02SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*14675a02SAndroid Build Coastguard Worker# limitations under the License. 14*14675a02SAndroid Build Coastguard Worker 15*14675a02SAndroid Build Coastguard Workerload("@system_provided_tf//:system_provided_tf.bzl", "tf_custom_op_library") 16*14675a02SAndroid Build Coastguard Workerload("@rules_python//python:defs.bzl", "py_binary", "py_test") 17*14675a02SAndroid Build Coastguard Workerload("//fcp:config.bzl", "FCP_COPTS") 18*14675a02SAndroid Build Coastguard Workerload("//fcp/tracing:build_defs.bzl", "tracing_schema_cc_library") 19*14675a02SAndroid Build Coastguard Workerload("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_cc_test", "tf_gen_op_wrapper_py") 20*14675a02SAndroid Build Coastguard Workerload("@org_tensorflow//tensorflow:tensorflow.bzl", "tf_custom_op_py_library") 21*14675a02SAndroid Build Coastguard Workerload("@com_github_grpc_grpc//bazel:python_rules.bzl", "py_proto_library") 22*14675a02SAndroid Build Coastguard Worker 23*14675a02SAndroid Build Coastguard Workerdefault_visibility = ["//fcp:internal"] 24*14675a02SAndroid Build Coastguard Worker 25*14675a02SAndroid Build Coastguard Workerpackage( 26*14675a02SAndroid Build Coastguard Worker default_visibility = default_visibility, 27*14675a02SAndroid Build Coastguard Worker licenses = ["notice"], # Apache 2.0 28*14675a02SAndroid Build Coastguard Worker) 29*14675a02SAndroid Build Coastguard Worker 30*14675a02SAndroid Build Coastguard Workertf_cc_test( 31*14675a02SAndroid Build Coastguard Worker name = "tf_smoke_test", 32*14675a02SAndroid Build Coastguard Worker srcs = ["tf_smoke_test.cc"], 33*14675a02SAndroid Build Coastguard Worker extra_copts = FCP_COPTS, 34*14675a02SAndroid Build Coastguard Worker deps = [ 35*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 36*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/cc:cc_ops", 37*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/cc:client_session", 38*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 39*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:tensorflow_opensource", 40*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:testlib", 41*14675a02SAndroid Build Coastguard Worker ], 42*14675a02SAndroid Build Coastguard Worker) 43*14675a02SAndroid Build Coastguard Worker 44*14675a02SAndroid Build Coastguard Workerpy_test( 45*14675a02SAndroid Build Coastguard Worker name = "tf_py_smoke_test", 46*14675a02SAndroid Build Coastguard Worker srcs = ["tf_py_smoke_test.py"], 47*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 48*14675a02SAndroid Build Coastguard Worker) 49*14675a02SAndroid Build Coastguard Worker 50*14675a02SAndroid Build Coastguard Worker# Library for converting between the FCP and TensorFlow versions of a Status. 51*14675a02SAndroid Build Coastguard Worker# Note that this library is intended to be usable in an op .so, thus it depends 52*14675a02SAndroid Build Coastguard Worker# on TF headers but *not* an implementation (the final binary needs to link it 53*14675a02SAndroid Build Coastguard Worker# in). We must also use the right copy of headers, depending on whether the 54*14675a02SAndroid Build Coastguard Worker# build is targeting a system-provided TF library or a bazel-built one. 55*14675a02SAndroid Build Coastguard Workercc_library( 56*14675a02SAndroid Build Coastguard Worker name = "status", 57*14675a02SAndroid Build Coastguard Worker srcs = [ 58*14675a02SAndroid Build Coastguard Worker "status.cc", 59*14675a02SAndroid Build Coastguard Worker ], 60*14675a02SAndroid Build Coastguard Worker hdrs = [ 61*14675a02SAndroid Build Coastguard Worker "status.h", 62*14675a02SAndroid Build Coastguard Worker ], 63*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 64*14675a02SAndroid Build Coastguard Worker deps = [ 65*14675a02SAndroid Build Coastguard Worker "//fcp/base", 66*14675a02SAndroid Build Coastguard Worker ] + select({ 67*14675a02SAndroid Build Coastguard Worker "@system_provided_tf//:system_provided_tf_build": ["@system_provided_tf//:tf_headers"], 68*14675a02SAndroid Build Coastguard Worker "//conditions:default": ["@org_tensorflow//tensorflow/core:framework_headers_lib"], 69*14675a02SAndroid Build Coastguard Worker }), 70*14675a02SAndroid Build Coastguard Worker) 71*14675a02SAndroid Build Coastguard Worker 72*14675a02SAndroid Build Coastguard Workercc_test( 73*14675a02SAndroid Build Coastguard Worker name = "status_test", 74*14675a02SAndroid Build Coastguard Worker srcs = [ 75*14675a02SAndroid Build Coastguard Worker "status_test.cc", 76*14675a02SAndroid Build Coastguard Worker ], 77*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 78*14675a02SAndroid Build Coastguard Worker deps = [ 79*14675a02SAndroid Build Coastguard Worker ":status", 80*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 81*14675a02SAndroid Build Coastguard Worker # See remarks on :status about the TF framework dependency 82*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 83*14675a02SAndroid Build Coastguard Worker ], 84*14675a02SAndroid Build Coastguard Worker) 85*14675a02SAndroid Build Coastguard Worker 86*14675a02SAndroid Build Coastguard Workercc_library( 87*14675a02SAndroid Build Coastguard Worker name = "host_object", 88*14675a02SAndroid Build Coastguard Worker srcs = [ 89*14675a02SAndroid Build Coastguard Worker "host_object.cc", 90*14675a02SAndroid Build Coastguard Worker ], 91*14675a02SAndroid Build Coastguard Worker hdrs = [ 92*14675a02SAndroid Build Coastguard Worker "host_object.h", 93*14675a02SAndroid Build Coastguard Worker ], 94*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 95*14675a02SAndroid Build Coastguard Worker visibility = default_visibility + [ 96*14675a02SAndroid Build Coastguard Worker ], 97*14675a02SAndroid Build Coastguard Worker deps = [ 98*14675a02SAndroid Build Coastguard Worker "//fcp/base", 99*14675a02SAndroid Build Coastguard Worker "//fcp/base:random_token", 100*14675a02SAndroid Build Coastguard Worker "//fcp/base:unique_value", 101*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/base:core_headers", 102*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/container:flat_hash_map", 103*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/synchronization", 104*14675a02SAndroid Build Coastguard Worker ], 105*14675a02SAndroid Build Coastguard Worker) 106*14675a02SAndroid Build Coastguard Worker 107*14675a02SAndroid Build Coastguard Workercc_test( 108*14675a02SAndroid Build Coastguard Worker name = "host_object_test", 109*14675a02SAndroid Build Coastguard Worker srcs = [ 110*14675a02SAndroid Build Coastguard Worker "host_object_test.cc", 111*14675a02SAndroid Build Coastguard Worker ], 112*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 113*14675a02SAndroid Build Coastguard Worker deps = [ 114*14675a02SAndroid Build Coastguard Worker ":host_object", 115*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 116*14675a02SAndroid Build Coastguard Worker ], 117*14675a02SAndroid Build Coastguard Worker) 118*14675a02SAndroid Build Coastguard Worker 119*14675a02SAndroid Build Coastguard Workertracing_schema_cc_library( 120*14675a02SAndroid Build Coastguard Worker name = "tracing_schema", 121*14675a02SAndroid Build Coastguard Worker srcs = ["tracing_schema.fbs"], 122*14675a02SAndroid Build Coastguard Worker) 123*14675a02SAndroid Build Coastguard Worker 124*14675a02SAndroid Build Coastguard Workercc_library( 125*14675a02SAndroid Build Coastguard Worker name = "tf_session", 126*14675a02SAndroid Build Coastguard Worker srcs = ["tf_session.cc"], 127*14675a02SAndroid Build Coastguard Worker hdrs = ["tf_session.h"], 128*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 129*14675a02SAndroid Build Coastguard Worker deps = [ 130*14675a02SAndroid Build Coastguard Worker ":status", 131*14675a02SAndroid Build Coastguard Worker ":tracing_schema", 132*14675a02SAndroid Build Coastguard Worker "//fcp/base", 133*14675a02SAndroid Build Coastguard Worker "//fcp/base:process_unique_id", 134*14675a02SAndroid Build Coastguard Worker "//fcp/base:result", 135*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_cc_proto", 136*14675a02SAndroid Build Coastguard Worker "//fcp/tracing", 137*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/container:flat_hash_map", 138*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings", 139*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings:cord", 140*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:core_cpu", 141*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 142*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:tensorflow", 143*14675a02SAndroid Build Coastguard Worker ], 144*14675a02SAndroid Build Coastguard Worker) 145*14675a02SAndroid Build Coastguard Worker 146*14675a02SAndroid Build Coastguard Workercc_test( 147*14675a02SAndroid Build Coastguard Worker name = "tf_session_test", 148*14675a02SAndroid Build Coastguard Worker srcs = ["tf_session_test.cc"], 149*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 150*14675a02SAndroid Build Coastguard Worker deps = [ 151*14675a02SAndroid Build Coastguard Worker ":tf_session", 152*14675a02SAndroid Build Coastguard Worker ":tracing_schema", 153*14675a02SAndroid Build Coastguard Worker "//fcp/base:tracing_schema", 154*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_cc_proto", 155*14675a02SAndroid Build Coastguard Worker "//fcp/tensorflow/testing:tf_helper", 156*14675a02SAndroid Build Coastguard Worker "//fcp/testing:result_matchers", 157*14675a02SAndroid Build Coastguard Worker "//fcp/tracing:test_tracing_recorder", 158*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 159*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/cc:cc_ops", 160*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/cc:scope", 161*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 162*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:tensorflow", 163*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:testlib", 164*14675a02SAndroid Build Coastguard Worker ], 165*14675a02SAndroid Build Coastguard Worker) 166*14675a02SAndroid Build Coastguard Worker 167*14675a02SAndroid Build Coastguard Worker# C++ interfaces for implementing an 'external dataset' (a kind of host object). 168*14675a02SAndroid Build Coastguard Worker# Note this does *not* depend on TensorFlow. 169*14675a02SAndroid Build Coastguard Workercc_library( 170*14675a02SAndroid Build Coastguard Worker name = "external_dataset", 171*14675a02SAndroid Build Coastguard Worker srcs = [ 172*14675a02SAndroid Build Coastguard Worker ], 173*14675a02SAndroid Build Coastguard Worker hdrs = [ 174*14675a02SAndroid Build Coastguard Worker "external_dataset.h", 175*14675a02SAndroid Build Coastguard Worker ], 176*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 177*14675a02SAndroid Build Coastguard Worker visibility = default_visibility + [ 178*14675a02SAndroid Build Coastguard Worker ], 179*14675a02SAndroid Build Coastguard Worker deps = [ 180*14675a02SAndroid Build Coastguard Worker ":host_object", 181*14675a02SAndroid Build Coastguard Worker "//fcp/base:bounds", 182*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/status", 183*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/status:statusor", 184*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings", 185*14675a02SAndroid Build Coastguard Worker ], 186*14675a02SAndroid Build Coastguard Worker) 187*14675a02SAndroid Build Coastguard Worker 188*14675a02SAndroid Build Coastguard Worker# The targets below produce a custom op, which involves a native library as 189*14675a02SAndroid Build Coastguard Worker# well as Python wrappers. There is some significant complexity arising from 190*14675a02SAndroid Build Coastguard Worker# the various ways that an op / kernel might be linked in, which we'll try to 191*14675a02SAndroid Build Coastguard Worker# explain here: 192*14675a02SAndroid Build Coastguard Worker# 193*14675a02SAndroid Build Coastguard Worker# - Ops / kernels are meant to be buildable as DSOs (dynamic shared objects, 194*14675a02SAndroid Build Coastguard Worker# i.e. .so files). Yet, all ops and kernels must agree on the same 195*14675a02SAndroid Build Coastguard Worker# 'framework' for registration etc. When building a DSO, ops and kernels 196*14675a02SAndroid Build Coastguard Worker# can include TensorFlow framework *headers*, with implementations provided 197*14675a02SAndroid Build Coastguard Worker# by libtensorflow_framework.so at runtime. 198*14675a02SAndroid Build Coastguard Worker# 199*14675a02SAndroid Build Coastguard Worker# - When using ops / kernels (and TensorFlow) from a standard Python 200*14675a02SAndroid Build Coastguard Worker# interpreter, they *must* be loaded as DSOs. 201*14675a02SAndroid Build Coastguard Worker# 202*14675a02SAndroid Build Coastguard Worker# - When using ops / kernels (and TensorFlow) from C++, we have the option of 203*14675a02SAndroid Build Coastguard Worker# linking a monolithic binary, with Bazel's usual handling of deps. This is 204*14675a02SAndroid Build Coastguard Worker# in fact necessary to generate Python wrapper code (the generator links in 205*14675a02SAndroid Build Coastguard Worker# cc_library deps). 206*14675a02SAndroid Build Coastguard Worker# 207*14675a02SAndroid Build Coastguard Worker# Below, we generate *both* a DSO and cc_library variant of the ExternalDataset 208*14675a02SAndroid Build Coastguard Worker# op and kernel: 209*14675a02SAndroid Build Coastguard Worker# cc_library: :external_dataset_op_lib 210*14675a02SAndroid Build Coastguard Worker# DSO: _external_dataset_op.so 211*14675a02SAndroid Build Coastguard Worker# 212*14675a02SAndroid Build Coastguard Worker# The ExternalDataset op is a peculiar case, since it is specifically intended 213*14675a02SAndroid Build Coastguard Worker# to use objects provided by the program hosting TensorFlow (beyond the usual 214*14675a02SAndroid Build Coastguard Worker# TensorFlow APIs). This is problematic, since separate host and DSO binaries 215*14675a02SAndroid Build Coastguard Worker# each end up with their own definitions of symbols from common libraries (and 216*14675a02SAndroid Build Coastguard Worker# likely export them!). Though this might appear to work sometimes, it must be 217*14675a02SAndroid Build Coastguard Worker# avoided. 218*14675a02SAndroid Build Coastguard Worker# See e.g. https://github.com/abseil/abseil-cpp/issues/125 219*14675a02SAndroid Build Coastguard Worker# 220*14675a02SAndroid Build Coastguard Worker# --------------------------- 221*14675a02SAndroid Build Coastguard Worker# | _external_dataset_op.so | 222*14675a02SAndroid Build Coastguard Worker# ------------- -> | absl | 223*14675a02SAndroid Build Coastguard Worker# | Host | / | fcp/base | 224*14675a02SAndroid Build Coastguard Worker# | absl | --------------------------- 225*14675a02SAndroid Build Coastguard Worker# | fcp/base | \ | 226*14675a02SAndroid Build Coastguard Worker# ------------- \ v 227*14675a02SAndroid Build Coastguard Worker# \ ------------------------------ 228*14675a02SAndroid Build Coastguard Worker# -> | libtensorflow_framework.so | 229*14675a02SAndroid Build Coastguard Worker# ------------------------------ 230*14675a02SAndroid Build Coastguard Worker# 231*14675a02SAndroid Build Coastguard Worker# When using the cc_library version and Bazel's usual handling of the deps 232*14675a02SAndroid Build Coastguard Worker# graph, this is of course not a problem. 233*14675a02SAndroid Build Coastguard Worker# 234*14675a02SAndroid Build Coastguard Worker# As such, the DSO version is specifically useful for *building graphs in 235*14675a02SAndroid Build Coastguard Worker# Python* and therefore targets the system-provided Python TensorFlow package. 236*14675a02SAndroid Build Coastguard Worker# (C++) host programs must use the cc_library version. 237*14675a02SAndroid Build Coastguard Worker 238*14675a02SAndroid Build Coastguard WorkerEXTERNAL_DATASET_OP_SRCS = ["external_dataset_op.cc"] 239*14675a02SAndroid Build Coastguard Worker 240*14675a02SAndroid Build Coastguard WorkerEXTERNAL_DATASET_OP_DEPS = [ 241*14675a02SAndroid Build Coastguard Worker ":external_dataset", 242*14675a02SAndroid Build Coastguard Worker ":status", 243*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings:str_format", 244*14675a02SAndroid Build Coastguard Worker "//fcp/base:random_token", 245*14675a02SAndroid Build Coastguard Worker] 246*14675a02SAndroid Build Coastguard Worker 247*14675a02SAndroid Build Coastguard Worker# Public: TensorFlow op and op-kernel, that delegates to an ExternalDatasetStub 248*14675a02SAndroid Build Coastguard Worker# host object. This is the cc_library version. See explanation above. 249*14675a02SAndroid Build Coastguard Workercc_library( 250*14675a02SAndroid Build Coastguard Worker name = "external_dataset_op_lib", 251*14675a02SAndroid Build Coastguard Worker srcs = EXTERNAL_DATASET_OP_SRCS, 252*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 253*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 254*14675a02SAndroid Build Coastguard Worker deps = EXTERNAL_DATASET_OP_DEPS + [ 255*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 256*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 257*14675a02SAndroid Build Coastguard Worker ], 258*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 259*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 260*14675a02SAndroid Build Coastguard Worker) 261*14675a02SAndroid Build Coastguard Worker 262*14675a02SAndroid Build Coastguard Worker# DSO version of :external_dataset_op_lib, intended to be loaded by Python 263*14675a02SAndroid Build Coastguard Worker# wrappers. See explanation above. 264*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 265*14675a02SAndroid Build Coastguard Worker name = "_external_dataset_op.so", 266*14675a02SAndroid Build Coastguard Worker srcs = EXTERNAL_DATASET_OP_SRCS, 267*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 268*14675a02SAndroid Build Coastguard Worker deps = EXTERNAL_DATASET_OP_DEPS, 269*14675a02SAndroid Build Coastguard Worker) 270*14675a02SAndroid Build Coastguard Worker 271*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. As this is a dataset op, 272*14675a02SAndroid Build Coastguard Worker# it's not useful directly; see :external_dataset_py. 273*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 274*14675a02SAndroid Build Coastguard Worker name = "gen_external_dataset_py", 275*14675a02SAndroid Build Coastguard Worker out = "gen_external_dataset_py.py", 276*14675a02SAndroid Build Coastguard Worker deps = [ 277*14675a02SAndroid Build Coastguard Worker ":external_dataset_op_lib", 278*14675a02SAndroid Build Coastguard Worker ], 279*14675a02SAndroid Build Coastguard Worker) 280*14675a02SAndroid Build Coastguard Worker 281*14675a02SAndroid Build Coastguard Worker# Public: Python library for ExternalDataset. 282*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 283*14675a02SAndroid Build Coastguard Worker name = "external_dataset_py", 284*14675a02SAndroid Build Coastguard Worker srcs = ["external_dataset.py"], 285*14675a02SAndroid Build Coastguard Worker dso = [":_external_dataset_op.so"], 286*14675a02SAndroid Build Coastguard Worker kernels = [ 287*14675a02SAndroid Build Coastguard Worker ":external_dataset_op_lib", 288*14675a02SAndroid Build Coastguard Worker ], 289*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 290*14675a02SAndroid Build Coastguard Worker deps = [":gen_external_dataset_py"], 291*14675a02SAndroid Build Coastguard Worker) 292*14675a02SAndroid Build Coastguard Worker 293*14675a02SAndroid Build Coastguard Worker# The dataset API isn't really usable from C++, so we generate a GraphDef for 294*14675a02SAndroid Build Coastguard Worker# testing using Python. 295*14675a02SAndroid Build Coastguard Workerpy_binary( 296*14675a02SAndroid Build Coastguard Worker name = "make_external_dataset_test_graph", 297*14675a02SAndroid Build Coastguard Worker testonly = True, 298*14675a02SAndroid Build Coastguard Worker srcs = ["make_external_dataset_test_graph.py"], 299*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 300*14675a02SAndroid Build Coastguard Worker deps = [":external_dataset_py"], 301*14675a02SAndroid Build Coastguard Worker) 302*14675a02SAndroid Build Coastguard Worker 303*14675a02SAndroid Build Coastguard Workergenrule( 304*14675a02SAndroid Build Coastguard Worker name = "external_dataset_test_graph", 305*14675a02SAndroid Build Coastguard Worker testonly = True, 306*14675a02SAndroid Build Coastguard Worker srcs = [], 307*14675a02SAndroid Build Coastguard Worker outs = ["external_dataset_test.pbtxt"], 308*14675a02SAndroid Build Coastguard Worker cmd = "$(location :make_external_dataset_test_graph) --output \"$@\"", 309*14675a02SAndroid Build Coastguard Worker tools = [":make_external_dataset_test_graph"], 310*14675a02SAndroid Build Coastguard Worker) 311*14675a02SAndroid Build Coastguard Worker 312*14675a02SAndroid Build Coastguard Worker# Selector proto used in test dataset stubs and example selector fuser op. 313*14675a02SAndroid Build Coastguard Workerproto_library( 314*14675a02SAndroid Build Coastguard Worker name = "test_selector_proto", 315*14675a02SAndroid Build Coastguard Worker testonly = True, 316*14675a02SAndroid Build Coastguard Worker srcs = [ 317*14675a02SAndroid Build Coastguard Worker "test_selector.proto", 318*14675a02SAndroid Build Coastguard Worker ], 319*14675a02SAndroid Build Coastguard Worker) 320*14675a02SAndroid Build Coastguard Worker 321*14675a02SAndroid Build Coastguard Workercc_proto_library( 322*14675a02SAndroid Build Coastguard Worker name = "test_selector_cc_proto", 323*14675a02SAndroid Build Coastguard Worker testonly = True, 324*14675a02SAndroid Build Coastguard Worker deps = [":test_selector_proto"], 325*14675a02SAndroid Build Coastguard Worker) 326*14675a02SAndroid Build Coastguard Worker 327*14675a02SAndroid Build Coastguard Workertf_cc_test( 328*14675a02SAndroid Build Coastguard Worker name = "external_dataset_op_test", 329*14675a02SAndroid Build Coastguard Worker srcs = ["external_dataset_op_test.cc"], 330*14675a02SAndroid Build Coastguard Worker data = [ 331*14675a02SAndroid Build Coastguard Worker "external_dataset_test.pbtxt", 332*14675a02SAndroid Build Coastguard Worker ], 333*14675a02SAndroid Build Coastguard Worker extra_copts = FCP_COPTS, 334*14675a02SAndroid Build Coastguard Worker deps = [ 335*14675a02SAndroid Build Coastguard Worker ":external_dataset", 336*14675a02SAndroid Build Coastguard Worker ":external_dataset_op_lib", 337*14675a02SAndroid Build Coastguard Worker ":test_selector_cc_proto", 338*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 339*14675a02SAndroid Build Coastguard Worker "@com_google_protobuf//:protobuf", 340*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:core_cpu", 341*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:direct_session", 342*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 343*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 344*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:tensorflow_opensource", 345*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:testlib", 346*14675a02SAndroid Build Coastguard Worker ], 347*14675a02SAndroid Build Coastguard Worker) 348*14675a02SAndroid Build Coastguard Worker 349*14675a02SAndroid Build Coastguard WorkerCRC32_OP_SRCS = [ 350*14675a02SAndroid Build Coastguard Worker "crc32_op.cc", 351*14675a02SAndroid Build Coastguard Worker "tensor_crc32.cc", 352*14675a02SAndroid Build Coastguard Worker] 353*14675a02SAndroid Build Coastguard Worker 354*14675a02SAndroid Build Coastguard Worker# Custom op to compute the CRC32 checksum of a tensor. 355*14675a02SAndroid Build Coastguard Workercc_library( 356*14675a02SAndroid Build Coastguard Worker name = "crc32_op_lib", 357*14675a02SAndroid Build Coastguard Worker srcs = [ 358*14675a02SAndroid Build Coastguard Worker "crc32_op.cc", 359*14675a02SAndroid Build Coastguard Worker "tensor_crc32.cc", 360*14675a02SAndroid Build Coastguard Worker ], 361*14675a02SAndroid Build Coastguard Worker hdrs = ["tensor_crc32.h"], 362*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 363*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 364*14675a02SAndroid Build Coastguard Worker deps = [ 365*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 366*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 367*14675a02SAndroid Build Coastguard Worker ], 368*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 369*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 370*14675a02SAndroid Build Coastguard Worker) 371*14675a02SAndroid Build Coastguard Worker 372*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 373*14675a02SAndroid Build Coastguard Worker name = "_crc32_op.so", 374*14675a02SAndroid Build Coastguard Worker srcs = CRC32_OP_SRCS + ["tensor_crc32.h"], 375*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 376*14675a02SAndroid Build Coastguard Worker) 377*14675a02SAndroid Build Coastguard Worker 378*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 379*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 380*14675a02SAndroid Build Coastguard Worker name = "gen_crc32_py", 381*14675a02SAndroid Build Coastguard Worker out = "gen_crc32_py.py", 382*14675a02SAndroid Build Coastguard Worker deps = [ 383*14675a02SAndroid Build Coastguard Worker ":crc32_op_lib", 384*14675a02SAndroid Build Coastguard Worker ], 385*14675a02SAndroid Build Coastguard Worker) 386*14675a02SAndroid Build Coastguard Worker 387*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 388*14675a02SAndroid Build Coastguard Worker name = "crc32_py", 389*14675a02SAndroid Build Coastguard Worker srcs = ["crc32.py"], 390*14675a02SAndroid Build Coastguard Worker dso = [":_crc32_op.so"], 391*14675a02SAndroid Build Coastguard Worker kernels = [ 392*14675a02SAndroid Build Coastguard Worker ":crc32_op_lib", 393*14675a02SAndroid Build Coastguard Worker ], 394*14675a02SAndroid Build Coastguard Worker deps = [":gen_crc32_py"], 395*14675a02SAndroid Build Coastguard Worker) 396*14675a02SAndroid Build Coastguard Worker 397*14675a02SAndroid Build Coastguard Workerpy_test( 398*14675a02SAndroid Build Coastguard Worker name = "crc32_test", 399*14675a02SAndroid Build Coastguard Worker srcs = ["crc32_test.py"], 400*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 401*14675a02SAndroid Build Coastguard Worker deps = [":crc32_py"], 402*14675a02SAndroid Build Coastguard Worker) 403*14675a02SAndroid Build Coastguard Worker 404*14675a02SAndroid Build Coastguard WorkerEXAMPLE_SELECTOR_FUSER_OP_SRCS = ["example_selector_fuser_op.cc"] 405*14675a02SAndroid Build Coastguard Worker 406*14675a02SAndroid Build Coastguard WorkerEXAMPLE_SELECTOR_FUSER_OP_DEPS = [ 407*14675a02SAndroid Build Coastguard Worker "@com_google_protobuf//:protobuf", 408*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_cc_proto", 409*14675a02SAndroid Build Coastguard Worker] 410*14675a02SAndroid Build Coastguard Worker 411*14675a02SAndroid Build Coastguard Worker# Custom op to add resumption token to example selector. 412*14675a02SAndroid Build Coastguard Workercc_library( 413*14675a02SAndroid Build Coastguard Worker name = "example_selector_fuser_op_lib", 414*14675a02SAndroid Build Coastguard Worker srcs = EXAMPLE_SELECTOR_FUSER_OP_SRCS, 415*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 416*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 417*14675a02SAndroid Build Coastguard Worker deps = EXAMPLE_SELECTOR_FUSER_OP_DEPS + [ 418*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 419*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 420*14675a02SAndroid Build Coastguard Worker ], 421*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 422*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 423*14675a02SAndroid Build Coastguard Worker) 424*14675a02SAndroid Build Coastguard Worker 425*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 426*14675a02SAndroid Build Coastguard Worker name = "_example_selector_fuser_op.so", 427*14675a02SAndroid Build Coastguard Worker srcs = EXAMPLE_SELECTOR_FUSER_OP_SRCS, 428*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 429*14675a02SAndroid Build Coastguard Worker deps = EXAMPLE_SELECTOR_FUSER_OP_DEPS, 430*14675a02SAndroid Build Coastguard Worker) 431*14675a02SAndroid Build Coastguard Worker 432*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 433*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 434*14675a02SAndroid Build Coastguard Worker name = "gen_example_selector_fuser_op", 435*14675a02SAndroid Build Coastguard Worker out = "gen_example_selector_fuser_op.py", 436*14675a02SAndroid Build Coastguard Worker deps = [ 437*14675a02SAndroid Build Coastguard Worker ":example_selector_fuser_op_lib", 438*14675a02SAndroid Build Coastguard Worker ], 439*14675a02SAndroid Build Coastguard Worker) 440*14675a02SAndroid Build Coastguard Worker 441*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 442*14675a02SAndroid Build Coastguard Worker name = "example_selector_fuser_py", 443*14675a02SAndroid Build Coastguard Worker srcs = ["example_selector_fuser.py"], 444*14675a02SAndroid Build Coastguard Worker dso = [":_example_selector_fuser_op.so"], 445*14675a02SAndroid Build Coastguard Worker kernels = [ 446*14675a02SAndroid Build Coastguard Worker ":example_selector_fuser_op_lib", 447*14675a02SAndroid Build Coastguard Worker ], 448*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 449*14675a02SAndroid Build Coastguard Worker deps = [":gen_example_selector_fuser_op"], 450*14675a02SAndroid Build Coastguard Worker) 451*14675a02SAndroid Build Coastguard Worker 452*14675a02SAndroid Build Coastguard Workerpy_proto_library( 453*14675a02SAndroid Build Coastguard Worker name = "test_selector_py_pb2", 454*14675a02SAndroid Build Coastguard Worker testonly = True, 455*14675a02SAndroid Build Coastguard Worker deps = [ 456*14675a02SAndroid Build Coastguard Worker ":test_selector_proto", 457*14675a02SAndroid Build Coastguard Worker ], 458*14675a02SAndroid Build Coastguard Worker) 459*14675a02SAndroid Build Coastguard Worker 460*14675a02SAndroid Build Coastguard Workerpy_test( 461*14675a02SAndroid Build Coastguard Worker name = "example_selector_fuser_test", 462*14675a02SAndroid Build Coastguard Worker srcs = ["example_selector_fuser_test.py"], 463*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 464*14675a02SAndroid Build Coastguard Worker deps = [ 465*14675a02SAndroid Build Coastguard Worker ":example_selector_fuser_py", 466*14675a02SAndroid Build Coastguard Worker ":test_selector_py_pb2", 467*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_py_pb2", 468*14675a02SAndroid Build Coastguard Worker ], 469*14675a02SAndroid Build Coastguard Worker) 470*14675a02SAndroid Build Coastguard Worker 471*14675a02SAndroid Build Coastguard Worker# C++ library to set and access callbacks for slice serving requests. 472*14675a02SAndroid Build Coastguard Worker# Used by the `ServeSlices` custom op below. 473*14675a02SAndroid Build Coastguard Workercc_library( 474*14675a02SAndroid Build Coastguard Worker name = "serve_slices_registry", 475*14675a02SAndroid Build Coastguard Worker hdrs = [ 476*14675a02SAndroid Build Coastguard Worker "serve_slices_registry.h", 477*14675a02SAndroid Build Coastguard Worker ], 478*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 479*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 480*14675a02SAndroid Build Coastguard Worker deps = [ 481*14675a02SAndroid Build Coastguard Worker ":host_object", 482*14675a02SAndroid Build Coastguard Worker ], 483*14675a02SAndroid Build Coastguard Worker) 484*14675a02SAndroid Build Coastguard Worker 485*14675a02SAndroid Build Coastguard Workercc_test( 486*14675a02SAndroid Build Coastguard Worker name = "serve_slices_registry_test", 487*14675a02SAndroid Build Coastguard Worker srcs = ["serve_slices_registry_test.cc"], 488*14675a02SAndroid Build Coastguard Worker deps = [ 489*14675a02SAndroid Build Coastguard Worker ":host_object", 490*14675a02SAndroid Build Coastguard Worker ":serve_slices_registry", 491*14675a02SAndroid Build Coastguard Worker "//fcp/base:random_token", 492*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 493*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 494*14675a02SAndroid Build Coastguard Worker ], 495*14675a02SAndroid Build Coastguard Worker) 496*14675a02SAndroid Build Coastguard Worker 497*14675a02SAndroid Build Coastguard WorkerSERVE_SLICES_OP_SRCS = ["serve_slices_op.cc"] 498*14675a02SAndroid Build Coastguard Worker 499*14675a02SAndroid Build Coastguard WorkerSERVE_SLICES_OP_DEPS = [ 500*14675a02SAndroid Build Coastguard Worker ":serve_slices_registry", 501*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings", 502*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings:str_format", 503*14675a02SAndroid Build Coastguard Worker] 504*14675a02SAndroid Build Coastguard Worker 505*14675a02SAndroid Build Coastguard Worker# Custom op to register slices to serve for a `federated_select`. 506*14675a02SAndroid Build Coastguard Workercc_library( 507*14675a02SAndroid Build Coastguard Worker name = "serve_slices_op_lib", 508*14675a02SAndroid Build Coastguard Worker srcs = SERVE_SLICES_OP_SRCS, 509*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 510*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 511*14675a02SAndroid Build Coastguard Worker deps = SERVE_SLICES_OP_DEPS + [ 512*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 513*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 514*14675a02SAndroid Build Coastguard Worker ], 515*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 516*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 517*14675a02SAndroid Build Coastguard Worker) 518*14675a02SAndroid Build Coastguard Worker 519*14675a02SAndroid Build Coastguard Worker# DSO version of `:serve_slices_op_lib`, intended to be loaded by Python 520*14675a02SAndroid Build Coastguard Worker# wrappers. See explanation above starting with "The targets below...". 521*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 522*14675a02SAndroid Build Coastguard Worker name = "_serve_slices_op.so", 523*14675a02SAndroid Build Coastguard Worker srcs = SERVE_SLICES_OP_SRCS + [ 524*14675a02SAndroid Build Coastguard Worker # Bundling the registry and op ensures that the same HostObjectRegistry is used by both. 525*14675a02SAndroid Build Coastguard Worker "//fcp/tensorflow/python:serve_slices_registry.cc", 526*14675a02SAndroid Build Coastguard Worker ], 527*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 528*14675a02SAndroid Build Coastguard Worker deps = SERVE_SLICES_OP_DEPS + [ 529*14675a02SAndroid Build Coastguard Worker "@pybind11", 530*14675a02SAndroid Build Coastguard Worker "@pybind11_abseil//pybind11_abseil:absl_casters", 531*14675a02SAndroid Build Coastguard Worker ], 532*14675a02SAndroid Build Coastguard Worker) 533*14675a02SAndroid Build Coastguard Worker 534*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 535*14675a02SAndroid Build Coastguard Worker# Don't use this directly: use `:serve_slices_py` to ensure that the 536*14675a02SAndroid Build Coastguard Worker# appropriate shared libraries are loaded. 537*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 538*14675a02SAndroid Build Coastguard Worker name = "gen_serve_slices_py", 539*14675a02SAndroid Build Coastguard Worker out = "gen_serve_slices_py.py", 540*14675a02SAndroid Build Coastguard Worker deps = [ 541*14675a02SAndroid Build Coastguard Worker ":serve_slices_op_lib", 542*14675a02SAndroid Build Coastguard Worker ], 543*14675a02SAndroid Build Coastguard Worker) 544*14675a02SAndroid Build Coastguard Worker 545*14675a02SAndroid Build Coastguard Worker# Public: Python library for ServeSlices. 546*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 547*14675a02SAndroid Build Coastguard Worker name = "serve_slices_py", 548*14675a02SAndroid Build Coastguard Worker srcs = ["serve_slices.py"], 549*14675a02SAndroid Build Coastguard Worker dso = [":_serve_slices_op.so"], 550*14675a02SAndroid Build Coastguard Worker kernels = [ 551*14675a02SAndroid Build Coastguard Worker ":serve_slices_op_lib", 552*14675a02SAndroid Build Coastguard Worker ], 553*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 554*14675a02SAndroid Build Coastguard Worker deps = [":gen_serve_slices_py"], 555*14675a02SAndroid Build Coastguard Worker) 556*14675a02SAndroid Build Coastguard Worker 557*14675a02SAndroid Build Coastguard Worker# Generate a GraphDef for testing `ServeSlices` using Python. 558*14675a02SAndroid Build Coastguard Workerpy_binary( 559*14675a02SAndroid Build Coastguard Worker name = "make_serve_slices_test_graph", 560*14675a02SAndroid Build Coastguard Worker testonly = True, 561*14675a02SAndroid Build Coastguard Worker srcs = ["make_serve_slices_test_graph.py"], 562*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 563*14675a02SAndroid Build Coastguard Worker deps = [":serve_slices_py"], 564*14675a02SAndroid Build Coastguard Worker) 565*14675a02SAndroid Build Coastguard Worker 566*14675a02SAndroid Build Coastguard Workergenrule( 567*14675a02SAndroid Build Coastguard Worker name = "serve_slices_test_graph", 568*14675a02SAndroid Build Coastguard Worker testonly = True, 569*14675a02SAndroid Build Coastguard Worker srcs = [], 570*14675a02SAndroid Build Coastguard Worker outs = ["serve_slices_test.pbtxt"], 571*14675a02SAndroid Build Coastguard Worker cmd = "$(location :make_serve_slices_test_graph) --output \"$@\"", 572*14675a02SAndroid Build Coastguard Worker tools = [":make_serve_slices_test_graph"], 573*14675a02SAndroid Build Coastguard Worker) 574*14675a02SAndroid Build Coastguard Worker 575*14675a02SAndroid Build Coastguard Workertf_cc_test( 576*14675a02SAndroid Build Coastguard Worker name = "serve_slices_op_test", 577*14675a02SAndroid Build Coastguard Worker srcs = ["serve_slices_op_test.cc"], 578*14675a02SAndroid Build Coastguard Worker data = [ 579*14675a02SAndroid Build Coastguard Worker "serve_slices_test.pbtxt", 580*14675a02SAndroid Build Coastguard Worker ], 581*14675a02SAndroid Build Coastguard Worker extra_copts = FCP_COPTS, 582*14675a02SAndroid Build Coastguard Worker deps = [ 583*14675a02SAndroid Build Coastguard Worker ":serve_slices_op_lib", 584*14675a02SAndroid Build Coastguard Worker ":serve_slices_registry", 585*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings", 586*14675a02SAndroid Build Coastguard Worker "@com_google_googletest//:gtest_main", 587*14675a02SAndroid Build Coastguard Worker "@com_google_protobuf//:protobuf", 588*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:core_cpu", 589*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:direct_session", 590*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 591*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 592*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:tensorflow_opensource", 593*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:testlib", 594*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core/platform:status_matchers", 595*14675a02SAndroid Build Coastguard Worker ], 596*14675a02SAndroid Build Coastguard Worker) 597*14675a02SAndroid Build Coastguard Worker 598*14675a02SAndroid Build Coastguard WorkerMAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_SRCS = ["make_slices_selector_example_selector_op.cc"] 599*14675a02SAndroid Build Coastguard Worker 600*14675a02SAndroid Build Coastguard WorkerMAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_DEPS = [ 601*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings:str_format", 602*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_cc_proto", 603*14675a02SAndroid Build Coastguard Worker "//fcp/client:federated_select", 604*14675a02SAndroid Build Coastguard Worker] 605*14675a02SAndroid Build Coastguard Worker 606*14675a02SAndroid Build Coastguard Worker# Custom op to serialize an ExampleSelector containing a SlicesSelector proto. 607*14675a02SAndroid Build Coastguard Workercc_library( 608*14675a02SAndroid Build Coastguard Worker name = "make_slices_selector_example_selector_op_lib", 609*14675a02SAndroid Build Coastguard Worker srcs = MAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_SRCS, 610*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 611*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 612*14675a02SAndroid Build Coastguard Worker deps = ["@com_google_protobuf//:protobuf"] + MAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_DEPS + [ 613*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 614*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 615*14675a02SAndroid Build Coastguard Worker ], 616*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 617*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 618*14675a02SAndroid Build Coastguard Worker) 619*14675a02SAndroid Build Coastguard Worker 620*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 621*14675a02SAndroid Build Coastguard Worker name = "_make_slices_selector_example_selector_op.so", 622*14675a02SAndroid Build Coastguard Worker srcs = MAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_SRCS, 623*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 624*14675a02SAndroid Build Coastguard Worker deps = ["@com_google_protobuf//:protobuf"] + MAKE_SLICES_SELECTOR_EXAMPLE_SELECTOR_OP_DEPS, 625*14675a02SAndroid Build Coastguard Worker) 626*14675a02SAndroid Build Coastguard Worker 627*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 628*14675a02SAndroid Build Coastguard Worker# Don't use this directly: use `:make_slices_selector_py` to ensure that the 629*14675a02SAndroid Build Coastguard Worker# appropriate shared libraries are loaded. 630*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 631*14675a02SAndroid Build Coastguard Worker name = "gen_make_slices_selector_example_selector_py", 632*14675a02SAndroid Build Coastguard Worker out = "gen_make_slices_selector_example_selector_py.py", 633*14675a02SAndroid Build Coastguard Worker deps = [ 634*14675a02SAndroid Build Coastguard Worker ":make_slices_selector_example_selector_op_lib", 635*14675a02SAndroid Build Coastguard Worker ], 636*14675a02SAndroid Build Coastguard Worker) 637*14675a02SAndroid Build Coastguard Worker 638*14675a02SAndroid Build Coastguard Worker# Public: Python library for the `MakeSlicesSelectorExampleSelector` op. 639*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 640*14675a02SAndroid Build Coastguard Worker name = "make_slices_selector_example_selector_py", 641*14675a02SAndroid Build Coastguard Worker srcs = ["make_slices_selector_example_selector.py"], 642*14675a02SAndroid Build Coastguard Worker dso = [":_make_slices_selector_example_selector_op.so"], 643*14675a02SAndroid Build Coastguard Worker kernels = [ 644*14675a02SAndroid Build Coastguard Worker ":make_slices_selector_example_selector_op_lib", 645*14675a02SAndroid Build Coastguard Worker ], 646*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 647*14675a02SAndroid Build Coastguard Worker deps = [":gen_make_slices_selector_example_selector_py"], 648*14675a02SAndroid Build Coastguard Worker) 649*14675a02SAndroid Build Coastguard Worker 650*14675a02SAndroid Build Coastguard Worker# Test `MakeSlicesSelectorExampleSelector` using Python. 651*14675a02SAndroid Build Coastguard Workerpy_test( 652*14675a02SAndroid Build Coastguard Worker name = "make_slices_selector_example_selector_test", 653*14675a02SAndroid Build Coastguard Worker testonly = True, 654*14675a02SAndroid Build Coastguard Worker srcs = ["make_slices_selector_example_selector_test.py"], 655*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 656*14675a02SAndroid Build Coastguard Worker deps = [ 657*14675a02SAndroid Build Coastguard Worker ":make_slices_selector_example_selector_py", 658*14675a02SAndroid Build Coastguard Worker "//fcp/protos:plan_py_pb2", 659*14675a02SAndroid Build Coastguard Worker ], 660*14675a02SAndroid Build Coastguard Worker) 661*14675a02SAndroid Build Coastguard Worker 662*14675a02SAndroid Build Coastguard WorkerAPPEND_SLICES_OP_SRCS = ["append_slices_op.cc"] 663*14675a02SAndroid Build Coastguard Worker 664*14675a02SAndroid Build Coastguard WorkerAPPEND_SLICES_OP_DEPS = [ 665*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/base:core_headers", 666*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/synchronization", 667*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core/util:saved_tensor_slice_proto_cc", 668*14675a02SAndroid Build Coastguard Worker] 669*14675a02SAndroid Build Coastguard Worker 670*14675a02SAndroid Build Coastguard Worker# Custom op to serialize an ExampleSelector containing a SlicesSelector proto. 671*14675a02SAndroid Build Coastguard Workercc_library( 672*14675a02SAndroid Build Coastguard Worker name = "append_slices_op_lib", 673*14675a02SAndroid Build Coastguard Worker srcs = APPEND_SLICES_OP_SRCS, 674*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 675*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 676*14675a02SAndroid Build Coastguard Worker deps = APPEND_SLICES_OP_DEPS + [ 677*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 678*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 679*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 680*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core/kernels:save_restore_tensor", 681*14675a02SAndroid Build Coastguard Worker ], 682*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 683*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 684*14675a02SAndroid Build Coastguard Worker) 685*14675a02SAndroid Build Coastguard Worker 686*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 687*14675a02SAndroid Build Coastguard Worker name = "_append_slices_op.so", 688*14675a02SAndroid Build Coastguard Worker srcs = APPEND_SLICES_OP_SRCS, 689*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 690*14675a02SAndroid Build Coastguard Worker deps = APPEND_SLICES_OP_DEPS, 691*14675a02SAndroid Build Coastguard Worker) 692*14675a02SAndroid Build Coastguard Worker 693*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 694*14675a02SAndroid Build Coastguard Worker# Don't use this directly: use `:append_slices_py` to ensure that the 695*14675a02SAndroid Build Coastguard Worker# appropriate shared libraries are loaded. 696*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 697*14675a02SAndroid Build Coastguard Worker name = "gen_append_slices_py", 698*14675a02SAndroid Build Coastguard Worker out = "gen_append_slices_py.py", 699*14675a02SAndroid Build Coastguard Worker deps = [ 700*14675a02SAndroid Build Coastguard Worker ":append_slices_op_lib", 701*14675a02SAndroid Build Coastguard Worker ], 702*14675a02SAndroid Build Coastguard Worker) 703*14675a02SAndroid Build Coastguard Worker 704*14675a02SAndroid Build Coastguard Worker# Public: Python library for the `AppendSlices` and `MergeAppendedSlices` ops. 705*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 706*14675a02SAndroid Build Coastguard Worker name = "append_slices_py", 707*14675a02SAndroid Build Coastguard Worker srcs = ["append_slices.py"], 708*14675a02SAndroid Build Coastguard Worker dso = [":_append_slices_op.so"], 709*14675a02SAndroid Build Coastguard Worker kernels = [ 710*14675a02SAndroid Build Coastguard Worker ":append_slices_op_lib", 711*14675a02SAndroid Build Coastguard Worker ], 712*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 713*14675a02SAndroid Build Coastguard Worker deps = [":gen_append_slices_py"], 714*14675a02SAndroid Build Coastguard Worker) 715*14675a02SAndroid Build Coastguard Worker 716*14675a02SAndroid Build Coastguard Worker# Test `AppendSlices` and `MergeAppendedSlices` using Python. 717*14675a02SAndroid Build Coastguard Workerpy_test( 718*14675a02SAndroid Build Coastguard Worker name = "append_slices_test", 719*14675a02SAndroid Build Coastguard Worker testonly = True, 720*14675a02SAndroid Build Coastguard Worker srcs = ["append_slices_test.py"], 721*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 722*14675a02SAndroid Build Coastguard Worker deps = [ 723*14675a02SAndroid Build Coastguard Worker ":append_slices_py", 724*14675a02SAndroid Build Coastguard Worker ":delete_file_py", 725*14675a02SAndroid Build Coastguard Worker ], 726*14675a02SAndroid Build Coastguard Worker) 727*14675a02SAndroid Build Coastguard Worker 728*14675a02SAndroid Build Coastguard WorkerDELETE_FILE_OP_SRCS = ["delete_file_op.cc"] 729*14675a02SAndroid Build Coastguard Worker 730*14675a02SAndroid Build Coastguard WorkerDELETE_FILE_OP_DEPS = [ 731*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/base:core_headers", 732*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/synchronization", 733*14675a02SAndroid Build Coastguard Worker] 734*14675a02SAndroid Build Coastguard Worker 735*14675a02SAndroid Build Coastguard Worker# Custom op to serialize an ExampleSelector containing a SlicesSelector proto. 736*14675a02SAndroid Build Coastguard Workercc_library( 737*14675a02SAndroid Build Coastguard Worker name = "delete_file_op_lib", 738*14675a02SAndroid Build Coastguard Worker srcs = DELETE_FILE_OP_SRCS, 739*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 740*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 741*14675a02SAndroid Build Coastguard Worker deps = DELETE_FILE_OP_DEPS + [ 742*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 743*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 744*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:protos_all_cc", 745*14675a02SAndroid Build Coastguard Worker ], 746*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 747*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 748*14675a02SAndroid Build Coastguard Worker) 749*14675a02SAndroid Build Coastguard Worker 750*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 751*14675a02SAndroid Build Coastguard Worker name = "_delete_file_op.so", 752*14675a02SAndroid Build Coastguard Worker srcs = DELETE_FILE_OP_SRCS, 753*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 754*14675a02SAndroid Build Coastguard Worker deps = DELETE_FILE_OP_DEPS, 755*14675a02SAndroid Build Coastguard Worker) 756*14675a02SAndroid Build Coastguard Worker 757*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 758*14675a02SAndroid Build Coastguard Worker# Don't use this directly: use `:delete_file_py` to ensure that the 759*14675a02SAndroid Build Coastguard Worker# appropriate shared libraries are loaded. 760*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 761*14675a02SAndroid Build Coastguard Worker name = "gen_delete_file_py", 762*14675a02SAndroid Build Coastguard Worker out = "gen_delete_file_py.py", 763*14675a02SAndroid Build Coastguard Worker deps = [ 764*14675a02SAndroid Build Coastguard Worker ":delete_file_op_lib", 765*14675a02SAndroid Build Coastguard Worker ], 766*14675a02SAndroid Build Coastguard Worker) 767*14675a02SAndroid Build Coastguard Worker 768*14675a02SAndroid Build Coastguard Worker# Public: Python library for the `DeleteFile` ops. 769*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 770*14675a02SAndroid Build Coastguard Worker name = "delete_file_py", 771*14675a02SAndroid Build Coastguard Worker srcs = ["delete_file.py"], 772*14675a02SAndroid Build Coastguard Worker dso = [":_delete_file_op.so"], 773*14675a02SAndroid Build Coastguard Worker kernels = [ 774*14675a02SAndroid Build Coastguard Worker ":delete_file_op_lib", 775*14675a02SAndroid Build Coastguard Worker ], 776*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 777*14675a02SAndroid Build Coastguard Worker deps = [":gen_delete_file_py"], 778*14675a02SAndroid Build Coastguard Worker) 779*14675a02SAndroid Build Coastguard Worker 780*14675a02SAndroid Build Coastguard Worker# Test `DeleteFile` using Python. 781*14675a02SAndroid Build Coastguard Workerpy_test( 782*14675a02SAndroid Build Coastguard Worker name = "delete_file_test", 783*14675a02SAndroid Build Coastguard Worker testonly = True, 784*14675a02SAndroid Build Coastguard Worker srcs = ["delete_file_test.py"], 785*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 786*14675a02SAndroid Build Coastguard Worker deps = [":delete_file_py"], 787*14675a02SAndroid Build Coastguard Worker) 788*14675a02SAndroid Build Coastguard Worker 789*14675a02SAndroid Build Coastguard WorkerTENSOR_NAME_OP_SRCS = ["tensor_name_op.cc"] 790*14675a02SAndroid Build Coastguard Worker 791*14675a02SAndroid Build Coastguard WorkerTENSOR_NAME_OP_DEPS = [ 792*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/strings:str_format", 793*14675a02SAndroid Build Coastguard Worker] 794*14675a02SAndroid Build Coastguard Worker 795*14675a02SAndroid Build Coastguard Worker# Custom op to get the name of a tensor in the final graph at runtime. 796*14675a02SAndroid Build Coastguard Workercc_library( 797*14675a02SAndroid Build Coastguard Worker name = "tensor_name_op_lib", 798*14675a02SAndroid Build Coastguard Worker srcs = TENSOR_NAME_OP_SRCS, 799*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 800*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 801*14675a02SAndroid Build Coastguard Worker deps = TENSOR_NAME_OP_DEPS + [ 802*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 803*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 804*14675a02SAndroid Build Coastguard Worker ], 805*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 806*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 807*14675a02SAndroid Build Coastguard Worker) 808*14675a02SAndroid Build Coastguard Worker 809*14675a02SAndroid Build Coastguard Worker# DSO version of `:tensor_name_op_lib`, intended to be loaded by Python 810*14675a02SAndroid Build Coastguard Worker# wrappers. See explanation above starting with "The targets below...". 811*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 812*14675a02SAndroid Build Coastguard Worker name = "_tensor_name_op.so", 813*14675a02SAndroid Build Coastguard Worker srcs = TENSOR_NAME_OP_SRCS, 814*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 815*14675a02SAndroid Build Coastguard Worker deps = TENSOR_NAME_OP_DEPS, 816*14675a02SAndroid Build Coastguard Worker) 817*14675a02SAndroid Build Coastguard Worker 818*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. 819*14675a02SAndroid Build Coastguard Worker# Don't use this directly: use `:tensor_name_py` to ensure that the 820*14675a02SAndroid Build Coastguard Worker# appropriate shared libraries are loaded. 821*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 822*14675a02SAndroid Build Coastguard Worker name = "gen_tensor_name_py", 823*14675a02SAndroid Build Coastguard Worker out = "gen_tensor_name_py.py", 824*14675a02SAndroid Build Coastguard Worker deps = [ 825*14675a02SAndroid Build Coastguard Worker ":tensor_name_op_lib", 826*14675a02SAndroid Build Coastguard Worker ], 827*14675a02SAndroid Build Coastguard Worker) 828*14675a02SAndroid Build Coastguard Worker 829*14675a02SAndroid Build Coastguard Worker# Public: Python library for the `TensorName` op. 830*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 831*14675a02SAndroid Build Coastguard Worker name = "tensor_name_py", 832*14675a02SAndroid Build Coastguard Worker srcs = ["tensor_name.py"], 833*14675a02SAndroid Build Coastguard Worker dso = [":_tensor_name_op.so"], 834*14675a02SAndroid Build Coastguard Worker kernels = [ 835*14675a02SAndroid Build Coastguard Worker ":tensor_name_op_lib", 836*14675a02SAndroid Build Coastguard Worker ], 837*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 838*14675a02SAndroid Build Coastguard Worker deps = [":gen_tensor_name_py"], 839*14675a02SAndroid Build Coastguard Worker) 840*14675a02SAndroid Build Coastguard Worker 841*14675a02SAndroid Build Coastguard Worker# Test `TensorName` using Python. 842*14675a02SAndroid Build Coastguard Workerpy_test( 843*14675a02SAndroid Build Coastguard Worker name = "tensor_name_test", 844*14675a02SAndroid Build Coastguard Worker testonly = True, 845*14675a02SAndroid Build Coastguard Worker srcs = ["tensor_name_test.py"], 846*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 847*14675a02SAndroid Build Coastguard Worker deps = [":tensor_name_py"], 848*14675a02SAndroid Build Coastguard Worker) 849*14675a02SAndroid Build Coastguard Worker 850*14675a02SAndroid Build Coastguard WorkerTASK_ELIGIBILITY_INFO_OPS_SRCS = ["task_eligibility_info_ops.cc"] 851*14675a02SAndroid Build Coastguard Worker 852*14675a02SAndroid Build Coastguard WorkerTASK_ELIGIBILITY_INFO_OPS_DEPS = [ 853*14675a02SAndroid Build Coastguard Worker "//fcp/protos:federated_api_cc_proto", 854*14675a02SAndroid Build Coastguard Worker] 855*14675a02SAndroid Build Coastguard Worker 856*14675a02SAndroid Build Coastguard Workercc_library( 857*14675a02SAndroid Build Coastguard Worker name = "task_eligibility_info_ops_lib", 858*14675a02SAndroid Build Coastguard Worker srcs = TASK_ELIGIBILITY_INFO_OPS_SRCS, 859*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 860*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 861*14675a02SAndroid Build Coastguard Worker deps = TASK_ELIGIBILITY_INFO_OPS_DEPS + [ 862*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 863*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 864*14675a02SAndroid Build Coastguard Worker ], 865*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 866*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 867*14675a02SAndroid Build Coastguard Worker) 868*14675a02SAndroid Build Coastguard Worker 869*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 870*14675a02SAndroid Build Coastguard Worker name = "_task_eligibility_info_ops.so", 871*14675a02SAndroid Build Coastguard Worker srcs = TASK_ELIGIBILITY_INFO_OPS_SRCS, 872*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 873*14675a02SAndroid Build Coastguard Worker deps = TASK_ELIGIBILITY_INFO_OPS_DEPS, 874*14675a02SAndroid Build Coastguard Worker) 875*14675a02SAndroid Build Coastguard Worker 876*14675a02SAndroid Build Coastguard Worker# Generates the basic op wrapper for use in Python. We don't expose this wrapper 877*14675a02SAndroid Build Coastguard Worker# directly, and rather we create a more user-friendly wrapper below, which uses 878*14675a02SAndroid Build Coastguard Worker# this auto-generated one. 879*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 880*14675a02SAndroid Build Coastguard Worker name = "gen_task_eligibility_info_ops_py", 881*14675a02SAndroid Build Coastguard Worker out = "gen_task_eligibility_info_ops.py", 882*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:private"], 883*14675a02SAndroid Build Coastguard Worker deps = [ 884*14675a02SAndroid Build Coastguard Worker ":task_eligibility_info_ops_lib", 885*14675a02SAndroid Build Coastguard Worker ], 886*14675a02SAndroid Build Coastguard Worker) 887*14675a02SAndroid Build Coastguard Worker 888*14675a02SAndroid Build Coastguard Worker# Python library exposing the user-facing task eligibility info ops. 889*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 890*14675a02SAndroid Build Coastguard Worker name = "task_eligibility_info_ops_py", 891*14675a02SAndroid Build Coastguard Worker srcs = ["task_eligibility_info_ops.py"], 892*14675a02SAndroid Build Coastguard Worker dso = [":_task_eligibility_info_ops.so"], 893*14675a02SAndroid Build Coastguard Worker kernels = [ 894*14675a02SAndroid Build Coastguard Worker ":task_eligibility_info_ops_lib", 895*14675a02SAndroid Build Coastguard Worker ], 896*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 897*14675a02SAndroid Build Coastguard Worker deps = [":gen_task_eligibility_info_ops_py"], 898*14675a02SAndroid Build Coastguard Worker) 899*14675a02SAndroid Build Coastguard Worker 900*14675a02SAndroid Build Coastguard Workerpy_test( 901*14675a02SAndroid Build Coastguard Worker name = "task_eligibility_info_ops_test", 902*14675a02SAndroid Build Coastguard Worker srcs = ["task_eligibility_info_ops_test.py"], 903*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 904*14675a02SAndroid Build Coastguard Worker deps = [ 905*14675a02SAndroid Build Coastguard Worker ":task_eligibility_info_ops_py", 906*14675a02SAndroid Build Coastguard Worker "//fcp/protos:federated_api_py_pb2", 907*14675a02SAndroid Build Coastguard Worker ], 908*14675a02SAndroid Build Coastguard Worker) 909*14675a02SAndroid Build Coastguard Worker 910*14675a02SAndroid Build Coastguard WorkerDICTIONARY_OPS_SRCS = ["dictionary_ops.cc"] 911*14675a02SAndroid Build Coastguard Worker 912*14675a02SAndroid Build Coastguard WorkerDICTIONARY_OPS_DEPS = [ 913*14675a02SAndroid Build Coastguard Worker "//fcp/base", 914*14675a02SAndroid Build Coastguard Worker "//fcp/dictionary:dictionary_lib", 915*14675a02SAndroid Build Coastguard Worker "//fcp/dictionary:dictionary_cc_proto", 916*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/status", 917*14675a02SAndroid Build Coastguard Worker "@com_google_absl//absl/status:statusor", 918*14675a02SAndroid Build Coastguard Worker] 919*14675a02SAndroid Build Coastguard Worker 920*14675a02SAndroid Build Coastguard Workercc_library( 921*14675a02SAndroid Build Coastguard Worker name = "dictionary_ops_lib", 922*14675a02SAndroid Build Coastguard Worker srcs = DICTIONARY_OPS_SRCS, 923*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 924*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 925*14675a02SAndroid Build Coastguard Worker deps = DICTIONARY_OPS_DEPS + [ 926*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:framework", 927*14675a02SAndroid Build Coastguard Worker "@org_tensorflow//tensorflow/core:lib", 928*14675a02SAndroid Build Coastguard Worker ], 929*14675a02SAndroid Build Coastguard Worker # Uses TensorFlow's registration macros 930*14675a02SAndroid Build Coastguard Worker alwayslink = 1, 931*14675a02SAndroid Build Coastguard Worker) 932*14675a02SAndroid Build Coastguard Worker 933*14675a02SAndroid Build Coastguard Workertf_custom_op_library( 934*14675a02SAndroid Build Coastguard Worker name = "_dictionary_ops.so", 935*14675a02SAndroid Build Coastguard Worker srcs = DICTIONARY_OPS_SRCS, 936*14675a02SAndroid Build Coastguard Worker copts = FCP_COPTS, 937*14675a02SAndroid Build Coastguard Worker deps = DICTIONARY_OPS_DEPS, 938*14675a02SAndroid Build Coastguard Worker) 939*14675a02SAndroid Build Coastguard Worker 940*14675a02SAndroid Build Coastguard Workertf_gen_op_wrapper_py( 941*14675a02SAndroid Build Coastguard Worker name = "gen_dictionary_ops_py", 942*14675a02SAndroid Build Coastguard Worker out = "gen_dictionary_ops.py", 943*14675a02SAndroid Build Coastguard Worker op_allowlist = [ 944*14675a02SAndroid Build Coastguard Worker "DictionarySize", 945*14675a02SAndroid Build Coastguard Worker "DictionaryLookup", 946*14675a02SAndroid Build Coastguard Worker "DictionaryReverseLookup", 947*14675a02SAndroid Build Coastguard Worker ], 948*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:private"], 949*14675a02SAndroid Build Coastguard Worker deps = [":dictionary_ops_lib"], 950*14675a02SAndroid Build Coastguard Worker) 951*14675a02SAndroid Build Coastguard Worker 952*14675a02SAndroid Build Coastguard Workertf_custom_op_py_library( 953*14675a02SAndroid Build Coastguard Worker name = "dictionary_ops_py", 954*14675a02SAndroid Build Coastguard Worker srcs = ["dictionary_ops.py"], 955*14675a02SAndroid Build Coastguard Worker dso = [":_dictionary_ops.so"], 956*14675a02SAndroid Build Coastguard Worker kernels = [ 957*14675a02SAndroid Build Coastguard Worker ":dictionary_ops_lib", 958*14675a02SAndroid Build Coastguard Worker ], 959*14675a02SAndroid Build Coastguard Worker visibility = ["//visibility:public"], 960*14675a02SAndroid Build Coastguard Worker deps = [ 961*14675a02SAndroid Build Coastguard Worker ":gen_dictionary_ops_py", 962*14675a02SAndroid Build Coastguard Worker "//fcp/dictionary:dictionary_py_pb2", 963*14675a02SAndroid Build Coastguard Worker ], 964*14675a02SAndroid Build Coastguard Worker) 965*14675a02SAndroid Build Coastguard Worker 966*14675a02SAndroid Build Coastguard Workerpy_test( 967*14675a02SAndroid Build Coastguard Worker name = "dictionary_ops_test", 968*14675a02SAndroid Build Coastguard Worker srcs = ["dictionary_ops_test.py"], 969*14675a02SAndroid Build Coastguard Worker python_version = "PY3", 970*14675a02SAndroid Build Coastguard Worker deps = [ 971*14675a02SAndroid Build Coastguard Worker ":dictionary_ops_py", 972*14675a02SAndroid Build Coastguard Worker "//fcp/dictionary:dictionary_py_pb2", 973*14675a02SAndroid Build Coastguard Worker ], 974*14675a02SAndroid Build Coastguard Worker) 975