1# Description: 2# TensorFlow is a computational framework, primarily for use in machine 3# learning applications. 4 5package( 6 default_visibility = ["//visibility:public"], 7) 8 9licenses(["notice"]) # Apache 2.0 10 11filegroup( 12 name = "srcs", 13 srcs = [ 14 "framework/gradients.h", 15 "framework/ops.h", 16 "framework/scope.h", 17 "framework/scope_internal.h", 18 "ops/array_ops.h", 19 "ops/while_loop.h", 20 "//tensorflow/cc/saved_model:loader.h", 21 ], 22) 23 24load( 25 "//tensorflow:tensorflow.bzl", 26 "cc_library_with_android_deps", 27 "tf_cc_binary", 28 "tf_cc_test", 29 "tf_copts", 30 "tf_gen_op_wrappers_cc", 31 "transitive_hdrs", 32) 33 34cc_library( 35 name = "gradients", 36 srcs = [ 37 "framework/gradients.cc", 38 "framework/while_gradients.cc", 39 "framework/while_gradients.h", 40 ], 41 hdrs = ["framework/gradients.h"], 42 deps = [ 43 ":cc_ops", 44 ":cc_ops_internal", 45 ":grad_op_registry", 46 ":ops", 47 ":scope", 48 ":scope_internal", 49 ":while_loop", 50 "//tensorflow/core:core_cpu", 51 "//tensorflow/core:framework", 52 "//tensorflow/core:lib", 53 "//tensorflow/core:lib_internal", 54 ], 55) 56 57tf_cc_test( 58 name = "framework_gradients_test", 59 srcs = ["framework/gradients_test.cc"], 60 deps = [ 61 ":cc_ops", 62 ":client_session", 63 ":grad_op_registry", 64 ":grad_ops", 65 ":gradients", 66 ":testutil", 67 "//tensorflow/core:all_kernels", 68 "//tensorflow/core:framework", 69 "//tensorflow/core:framework_internal", 70 "//tensorflow/core:protos_all_cc", 71 "//tensorflow/core:test", 72 "//tensorflow/core:test_main", 73 "//tensorflow/core:testlib", 74 ], 75) 76 77tf_cc_test( 78 name = "framework_while_gradients_test", 79 size = "small", 80 srcs = ["framework/while_gradients_test.cc"], 81 deps = [ 82 ":cc_ops", 83 ":client_session", 84 ":grad_op_registry", 85 ":grad_ops", 86 ":gradients", 87 ":testutil", 88 ":while_loop", 89 "//tensorflow/core:all_kernels", 90 "//tensorflow/core:framework", 91 "//tensorflow/core:framework_internal", 92 "//tensorflow/core:protos_all_cc", 93 "//tensorflow/core:test", 94 "//tensorflow/core:test_main", 95 "//tensorflow/core:testlib", 96 ], 97) 98 99cc_library( 100 name = "gradient_checker", 101 srcs = ["framework/gradient_checker.cc"], 102 hdrs = ["framework/gradient_checker.h"], 103 deps = [ 104 ":cc_ops", 105 ":client_session", 106 ":gradients", 107 ":ops", 108 ":scope", 109 "//tensorflow/core:framework", 110 "//tensorflow/core:lib", 111 "//tensorflow/core:lib_internal", 112 ], 113) 114 115tf_cc_test( 116 name = "framework_gradient_checker_test", 117 srcs = ["framework/gradient_checker_test.cc"], 118 deps = [ 119 ":cc_ops", 120 ":grad_op_registry", 121 ":grad_ops", 122 ":gradient_checker", 123 ":testutil", 124 "//tensorflow/core:all_kernels", 125 "//tensorflow/core:framework", 126 "//tensorflow/core:framework_internal", 127 "//tensorflow/core:test", 128 "//tensorflow/core:test_main", 129 "//tensorflow/core:testlib", 130 ], 131) 132 133cc_library( 134 name = "grad_ops", 135 deps = [ 136 ":array_grad", 137 ":data_flow_grad", 138 ":image_grad", 139 ":math_grad", 140 ":nn_grad", 141 ], 142) 143 144cc_library( 145 name = "grad_testutil", 146 testonly = 1, 147 srcs = ["gradients/grad_testutil.cc"], 148 hdrs = ["gradients/grad_testutil.h"], 149 deps = [ 150 ":grad_op_registry", 151 ":ops", 152 ":scope", 153 ], 154) 155 156cc_library_with_android_deps( 157 name = "ops", 158 srcs = ["framework/ops.cc"], 159 hdrs = ["framework/ops.h"], 160 android_deps = ["//tensorflow/core:android_tensorflow_lib"], 161 deps = [ 162 "//tensorflow/core:core_cpu", 163 "//tensorflow/core:framework", 164 "//tensorflow/core:lib", 165 "//tensorflow/core:lib_internal", 166 "//tensorflow/core:ops", 167 "//tensorflow/core:protos_all_cc", 168 ], 169) 170 171cc_library_with_android_deps( 172 name = "scope", 173 srcs = [ 174 "framework/scope.cc", 175 "framework/scope_internal.h", 176 ], 177 hdrs = ["framework/scope.h"], 178 android_deps = ["//tensorflow/core:android_tensorflow_lib"], 179 common_deps = [ 180 ":ops", 181 ], 182 deps = [ 183 "//tensorflow/core:core_cpu", 184 "//tensorflow/core:framework", 185 "//tensorflow/core:lib", 186 "//tensorflow/core:protos_all_cc", 187 "@com_google_absl//absl/strings", 188 ], 189) 190 191cc_library_with_android_deps( 192 name = "scope_internal", 193 hdrs = ["framework/scope_internal.h"], 194 common_deps = [ 195 ":scope", 196 ], 197 deps = [], 198) 199 200tf_cc_test( 201 name = "framework_scope_test", 202 srcs = ["framework/scope_test.cc"], 203 deps = [ 204 ":ops", 205 ":scope", 206 "//tensorflow/core:framework", 207 "//tensorflow/core:test", 208 "//tensorflow/core:test_main", 209 "//tensorflow/core:testlib", 210 ], 211) 212 213cc_library_with_android_deps( 214 name = "client_session", 215 srcs = ["client/client_session.cc"], 216 hdrs = ["client/client_session.h"], 217 android_deps = ["//tensorflow/core:android_tensorflow_lib"], 218 common_deps = [ 219 ":ops", 220 ":scope", 221 ], 222 deps = [ 223 "//tensorflow/core:core_cpu", 224 "//tensorflow/core:lib", 225 "//tensorflow/core:protos_all_cc", 226 ], 227) 228 229tf_cc_test( 230 name = "client_client_session_test", 231 srcs = ["client/client_session_test.cc"], 232 deps = [ 233 ":cc_ops", 234 ":client_session", 235 "//tensorflow/core:all_kernels", 236 "//tensorflow/core:core_cpu_internal", 237 "//tensorflow/core:framework", 238 "//tensorflow/core:lib", 239 "//tensorflow/core:tensorflow", 240 "//tensorflow/core:test", 241 "//tensorflow/core:test_main", 242 "//tensorflow/core:testlib", 243 ], 244) 245 246cc_library_with_android_deps( 247 name = "const_op", 248 srcs = ["ops/const_op.cc"], 249 hdrs = ["ops/const_op.h"], 250 android_deps = [ 251 "//tensorflow/core:android_tensorflow_lib", 252 ], 253 common_deps = [ 254 ":ops", 255 ":scope", 256 ], 257 deps = [ 258 "//tensorflow/core:core_cpu", 259 "//tensorflow/core:framework", 260 ], 261) 262 263tf_cc_test( 264 name = "ops_const_op_test", 265 srcs = ["ops/const_op_test.cc"], 266 deps = [ 267 ":const_op", 268 "//tensorflow/core:framework", 269 "//tensorflow/core:test", 270 "//tensorflow/core:test_main", 271 "//tensorflow/core:testlib", 272 ], 273) 274 275cc_library_with_android_deps( 276 name = "while_loop", 277 srcs = ["ops/while_loop.cc"], 278 hdrs = ["ops/while_loop.h"], 279 android_deps = [ 280 "//tensorflow/core:android_tensorflow_lib", 281 ], 282 common_deps = [ 283 ":cc_ops", 284 ":cc_ops_internal", 285 ":ops", 286 ":scope", 287 ":scope_internal", 288 ], 289 deps = [ 290 "//tensorflow/core:core_cpu", 291 "//tensorflow/core:framework", 292 ], 293) 294 295tf_cc_test( 296 name = "ops_while_loop_test", 297 size = "small", 298 srcs = ["ops/while_loop_test.cc"], 299 deps = [ 300 ":cc_ops", 301 ":client_session", 302 ":testutil", 303 ":while_loop", 304 "//tensorflow/core:core_cpu", 305 "//tensorflow/core:test", 306 "//tensorflow/core:test_main", 307 "//tensorflow/core:testlib", 308 ], 309) 310 311cc_library( 312 name = "grad_op_registry", 313 srcs = ["framework/grad_op_registry.cc"], 314 hdrs = ["framework/grad_op_registry.h"], 315 deps = [ 316 ":ops", 317 ":scope", 318 ], 319) 320 321cc_library( 322 name = "array_grad", 323 srcs = ["gradients/array_grad.cc"], 324 deps = [ 325 ":cc_ops", 326 ":cc_ops_internal", 327 ":grad_op_registry", 328 ":gradients", 329 "//tensorflow/core:lib_proto_parsing", 330 ], 331 alwayslink = 1, 332) 333 334tf_cc_test( 335 name = "gradients_array_grad_test", 336 srcs = ["gradients/array_grad_test.cc"], 337 deps = [ 338 ":array_grad", 339 ":cc_ops", 340 ":cc_ops_internal", 341 ":grad_op_registry", 342 ":grad_testutil", 343 ":gradient_checker", 344 ":testutil", 345 "//tensorflow/core:test", 346 "//tensorflow/core:test_main", 347 "//tensorflow/core:testlib", 348 ], 349) 350 351cc_library( 352 name = "image_grad", 353 srcs = ["gradients/image_grad.cc"], 354 deps = [ 355 ":cc_ops", 356 ":cc_ops_internal", 357 ":grad_op_registry", 358 ":gradients", 359 ], 360 alwayslink = 1, 361) 362 363tf_cc_test( 364 name = "gradients_image_grad_test", 365 srcs = ["gradients/image_grad_test.cc"], 366 deps = [ 367 ":cc_ops", 368 ":client_session", 369 ":grad_op_registry", 370 ":grad_testutil", 371 ":gradient_checker", 372 ":image_grad", 373 ":testutil", 374 "//tensorflow/core:lib_internal", 375 "//tensorflow/core:test", 376 "//tensorflow/core:test_main", 377 "//tensorflow/core:testlib", 378 ], 379) 380 381cc_library( 382 name = "math_grad", 383 srcs = ["gradients/math_grad.cc"], 384 deps = [ 385 ":cc_ops", 386 ":cc_ops_internal", 387 ":grad_op_registry", 388 ":gradients", 389 ], 390 alwayslink = 1, 391) 392 393tf_cc_test( 394 name = "gradients_math_grad_test", 395 srcs = ["gradients/math_grad_test.cc"], 396 deps = [ 397 ":cc_ops", 398 ":client_session", 399 ":grad_op_registry", 400 ":grad_testutil", 401 ":gradient_checker", 402 ":gradients", 403 ":math_grad", 404 ":testutil", 405 "//tensorflow/core:lib_internal", 406 "//tensorflow/core:test", 407 "//tensorflow/core:test_main", 408 "//tensorflow/core:testlib", 409 ], 410) 411 412cc_library( 413 name = "nn_grad", 414 srcs = ["gradients/nn_grad.cc"], 415 deps = [ 416 ":cc_ops", 417 ":cc_ops_internal", 418 ":grad_op_registry", 419 ":gradients", 420 ], 421 alwayslink = 1, 422) 423 424tf_cc_test( 425 name = "gradients_nn_grad_test", 426 srcs = ["gradients/nn_grad_test.cc"], 427 deps = [ 428 ":cc_ops", 429 ":cc_ops_internal", 430 ":grad_op_registry", 431 ":grad_testutil", 432 ":gradient_checker", 433 ":nn_grad", 434 ":testutil", 435 "//tensorflow/core:lib_internal", 436 "//tensorflow/core:test", 437 "//tensorflow/core:test_main", 438 "//tensorflow/core:testlib", 439 ], 440) 441 442cc_library( 443 name = "data_flow_grad", 444 srcs = ["gradients/data_flow_grad.cc"], 445 deps = [ 446 ":cc_ops", 447 ":cc_ops_internal", 448 ":grad_op_registry", 449 ":gradients", 450 ], 451 alwayslink = 1, 452) 453 454tf_cc_test( 455 name = "gradients_data_flow_grad_test", 456 size = "small", 457 srcs = ["gradients/data_flow_grad_test.cc"], 458 deps = [ 459 ":cc_ops", 460 ":data_flow_grad", 461 ":grad_op_registry", 462 ":grad_testutil", 463 ":gradient_checker", 464 ":testutil", 465 "//tensorflow/core:lib_internal", 466 "//tensorflow/core:test", 467 "//tensorflow/core:test_main", 468 "//tensorflow/core:testlib", 469 ], 470) 471 472# Generates separate libraries for array_ops and math_ops to reduce the dependency count of targets that depend on only these 473tf_gen_op_wrappers_cc( 474 name = "math_ops", 475 api_def_srcs = ["//tensorflow/core/api_def:base_api_def"], 476 op_lib_names = [ 477 "math_ops", 478 ], 479 pkg = "//tensorflow/core", 480) 481 482tf_gen_op_wrappers_cc( 483 name = "array_ops", 484 api_def_srcs = ["//tensorflow/core/api_def:base_api_def"], 485 op_lib_names = [ 486 "array_ops", 487 ], 488 pkg = "//tensorflow/core", 489) 490 491tf_gen_op_wrappers_cc( 492 name = "cc_ops", 493 api_def_srcs = ["//tensorflow/core/api_def:base_api_def"], 494 deps_internal = [ 495 ":array_ops_internal", 496 ":math_ops_internal", 497 ], 498 op_lib_names = [ 499 "audio_ops", 500 "candidate_sampling_ops", 501 "control_flow_ops", 502 "data_flow_ops", 503 "image_ops", 504 "io_ops", 505 "linalg_ops", 506 "list_ops", 507 "logging_ops", 508 "lookup_ops", 509 "manip_ops", 510 "nn_ops", 511 "no_op", 512 "parsing_ops", 513 "random_ops", 514 "sparse_ops", 515 "state_ops", 516 "string_ops", 517 "training_ops", 518 "user_ops", 519 ], 520 other_hdrs = [ 521 "ops/array_ops.h", 522 "ops/const_op.h", 523 "ops/math_ops.h", 524 "ops/standard_ops.h", 525 ], 526 other_hdrs_internal = [ 527 "ops/array_ops_internal.h", 528 "ops/math_ops_internal.h", 529 ], 530 pkg = "//tensorflow/core", 531 deps = [ 532 ":array_ops", 533 ":const_op", 534 ":math_ops", 535 "//tensorflow/cc:ops", 536 "//tensorflow/cc:scope", 537 ], 538) 539 540tf_cc_test( 541 name = "framework_cc_ops_test", 542 srcs = ["framework/cc_ops_test.cc"], 543 deps = [ 544 ":cc_ops", 545 ":client_session", 546 ":test_op", 547 ":test_op_op_lib", 548 ":testutil", 549 "//tensorflow/core:framework", 550 "//tensorflow/core:test", 551 "//tensorflow/core:test_main", 552 "//tensorflow/core:testlib", 553 ], 554) 555 556tf_gen_op_wrappers_cc( 557 name = "sendrecv_ops", 558 include_internal_ops = 1, 559 op_lib_names = [ 560 "sendrecv_ops", 561 ], 562 pkg = "//tensorflow/core", 563) 564 565tf_gen_op_wrappers_cc( 566 name = "function_ops", 567 include_internal_ops = 1, 568 op_lib_names = [ 569 "function_ops", 570 ], 571 pkg = "//tensorflow/core", 572 visibility = ["//tensorflow:internal"], 573) 574 575tf_gen_op_wrappers_cc( 576 name = "functional_ops", 577 include_internal_ops = 1, 578 op_lib_names = [ 579 "functional_ops", 580 ], 581 pkg = "//tensorflow/core", 582 visibility = ["//tensorflow:internal"], 583) 584 585tf_gen_op_wrappers_cc( 586 name = "resource_variable_ops", 587 include_internal_ops = 1, 588 op_lib_names = [ 589 "resource_variable_ops", 590 ], 591 pkg = "//tensorflow/core", 592 visibility = ["//tensorflow:internal"], 593) 594 595tf_gen_op_wrappers_cc( 596 name = "remote_fused_graph_ops", 597 op_lib_names = [ 598 "remote_fused_graph_ops", 599 ], 600 pkg = "//tensorflow/core", 601) 602 603tf_gen_op_wrappers_cc( 604 name = "tpu_ops", 605 include_internal_ops = 1, 606 op_lib_names = [ 607 "tpu_configuration_ops", 608 "tpu_cross_replica_ops", 609 "tpu_embedding_ops", 610 "tpu_functional_ops", 611 "tpu_heartbeat_ops", 612 "tpu_host_compute_ops", 613 "tpu_infeed_ops", 614 "tpu_outfeed_ops", 615 "tpu_ordinal_selector_ops", 616 "tpu_replication_ops", 617 ], 618 pkg = "//tensorflow/core", 619 visibility = ["//tensorflow:internal"], 620) 621 622cc_library( 623 name = "cc_op_gen_main", 624 srcs = [ 625 "framework/cc_op_gen.cc", 626 "framework/cc_op_gen.h", 627 "framework/cc_op_gen_main.cc", 628 ], 629 copts = tf_copts(), 630 data = [ 631 "//tensorflow/core/api_def:base_api_def", 632 ], 633 deps = [ 634 "//tensorflow/core:framework_headers_lib", 635 "//tensorflow/core:lib", 636 "//tensorflow/core:lib_internal", 637 "//tensorflow/core:op_gen_lib", 638 "//tensorflow/core:proto_text", 639 "//tensorflow/core:protos_all_cc", 640 ], 641) 642 643tf_cc_test( 644 name = "cc_op_gen_test", 645 srcs = [ 646 "framework/cc_op_gen.cc", 647 "framework/cc_op_gen.h", 648 "framework/cc_op_gen_test.cc", 649 ], 650 deps = [ 651 "//tensorflow/core:framework", 652 "//tensorflow/core:lib", 653 "//tensorflow/core:lib_internal", 654 "//tensorflow/core:op_gen_lib", 655 "//tensorflow/core:proto_text", 656 "//tensorflow/core:protos_all_cc", 657 "//tensorflow/core:test", 658 "//tensorflow/core:test_main", 659 ], 660) 661 662cc_library( 663 name = "test_op_op_lib", 664 srcs = ["framework/test_op.cc"], 665 linkstatic = 1, 666 deps = ["//tensorflow/core:framework"], 667 alwayslink = 1, 668) 669 670cc_library( 671 name = "testutil", 672 testonly = 1, 673 srcs = ["framework/testutil.cc"], 674 hdrs = ["framework/testutil.h"], 675 deps = [ 676 ":client_session", 677 ":ops", 678 ":scope", 679 "//tensorflow/core:core_cpu", 680 "//tensorflow/core:lib_internal", 681 "//tensorflow/core:tensorflow", 682 "//tensorflow/core:testlib", 683 ], 684) 685 686tf_gen_op_wrappers_cc( 687 name = "test_op", 688 op_lib_names = [ 689 "test_op", 690 ], 691) 692 693tf_cc_binary( 694 name = "tutorials_example_trainer", 695 srcs = ["tutorials/example_trainer.cc"], 696 copts = tf_copts(), 697 linkopts = select({ 698 "//tensorflow:windows": [], 699 "//tensorflow:macos": [ 700 "-lm", 701 "-lpthread", 702 ], 703 "//tensorflow:ios": [ 704 "-lm", 705 "-lpthread", 706 ], 707 "//conditions:default": [ 708 "-lm", 709 "-lpthread", 710 "-lrt", 711 ], 712 }), 713 deps = [ 714 ":cc_ops", 715 "//tensorflow/core:core_cpu", 716 "//tensorflow/core:framework", 717 "//tensorflow/core:lib", 718 "//tensorflow/core:protos_all_cc", 719 "//tensorflow/core:tensorflow", 720 ], 721) 722 723cc_library( 724 name = "queue_runner", 725 srcs = ["training/queue_runner.cc"], 726 hdrs = ["training/queue_runner.h"], 727 deps = [ 728 ":coordinator", 729 "//tensorflow/core:core_cpu", 730 "//tensorflow/core:lib", 731 "//tensorflow/core:lib_internal", 732 "//tensorflow/core:protos_all_cc", 733 "//tensorflow/core/kernels:ops_util", 734 ], 735) 736 737tf_cc_test( 738 name = "queue_runner_test", 739 srcs = ["training/queue_runner_test.cc"], 740 deps = [ 741 "coordinator", 742 ":cc_ops", 743 ":queue_runner", 744 ":scope", 745 "//tensorflow/core:core_cpu", 746 "//tensorflow/core:framework", 747 "//tensorflow/core:lib", 748 "//tensorflow/core:lib_internal", 749 "//tensorflow/core:protos_all_cc", 750 "//tensorflow/core:tensorflow", 751 "//tensorflow/core:test", 752 "//tensorflow/core:test_main", 753 "//tensorflow/core:testlib", 754 ], 755) 756 757cc_library( 758 name = "coordinator", 759 srcs = ["training/coordinator.cc"], 760 hdrs = ["training/coordinator.h"], 761 deps = [ 762 "//tensorflow/core:lib", 763 "//tensorflow/core:lib_internal", 764 "//tensorflow/core:protos_all_cc", 765 ], 766) 767 768tf_cc_test( 769 name = "coordinator_test", 770 srcs = ["training/coordinator_test.cc"], 771 deps = [ 772 ":cc_ops", 773 ":coordinator", 774 ":queue_runner", 775 ":scope", 776 "//tensorflow/core:core_cpu", 777 "//tensorflow/core:framework", 778 "//tensorflow/core:lib", 779 "//tensorflow/core:lib_internal", 780 "//tensorflow/core:protos_all_cc", 781 "//tensorflow/core:tensorflow", 782 "//tensorflow/core:test", 783 "//tensorflow/core:test_main", 784 "//tensorflow/core:testlib", 785 ], 786) 787 788transitive_hdrs( 789 name = "headers", 790 visibility = ["//tensorflow:__subpackages__"], 791 deps = [ 792 ":cc_ops", 793 ":client_session", 794 ":coordinator", 795 ":gradient_checker", 796 ":gradients", 797 ":ops", 798 ":queue_runner", 799 ":remote_fused_graph_ops", 800 ":scope", 801 "//tensorflow/cc/profiler", 802 "//tensorflow/cc/saved_model:constants", 803 "//tensorflow/cc/saved_model:loader", 804 "//tensorflow/cc/saved_model:reader", 805 "//tensorflow/cc/saved_model:signature_constants", 806 "//tensorflow/cc/saved_model:tag_constants", 807 "//tensorflow/cc/tools:freeze_saved_model", 808 ], 809) 810