Files
WeHub Mirror 16d3f15320
ARM CI / build (3.10) (push) Has been cancelled
cffconvert / validate (push) Has been cancelled
Creates a GitHub Issue when a PR Rolled back via Commit to Master / create-issue-on-pr-rollback (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
WeHub snapshot of ee606724a5c2f63bf60704cb3e1b169618993fd9
2026-08-07 16:11:07 +08:00

92 lines
3.5 KiB
Python

# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
load("@xla//third_party/rules_python/python:py_library.bzl", "py_library")
load("//tensorflow/core/platform:distribute.bzl", "distribute_py_strict_test")
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
licenses = ["notice"],
)
# Pybind rules must live in tensorflow/python due to header rule visibility.
exports_files(
["pywrap_parallel_device.cc"],
visibility = ["//tensorflow/python:__pkg__"],
)
py_library(
name = "parallel_device",
srcs = ["parallel_device.py"],
strict_deps = True,
visibility = [
"//tensorflow:internal",
"//third_party/py/tensorflow_numerics/extensions:__pkg__",
],
deps = [
"//tensorflow/python:_pywrap_parallel_device",
"//tensorflow/python/distribute:device_util",
"//tensorflow/python/eager:context",
"//tensorflow/python/framework:composite_tensor",
"//tensorflow/python/framework:constant_op",
"//tensorflow/python/framework:ops",
"//tensorflow/python/framework:tensor",
"//tensorflow/python/ops:array_ops",
"//tensorflow/python/ops:variables",
"//tensorflow/python/tpu/ops",
"//tensorflow/python/util:nest",
"//tensorflow/python/util:variable_utils",
],
)
distribute_py_strict_test(
name = "parallel_device_test",
srcs = ["parallel_device_test.py"],
# We don't only use TPU Runtime on parallel device, we use c_api_tfrt instead.
disable_tpu_use_tfrt = True,
tags = [
# Dependencies aren't otherwise included in the pip package yet.
"no_pip",
"notpu", # TODO(b/210159281)
],
deps = [
":parallel_device",
"//tensorflow/python/checkpoint",
"//tensorflow/python/checkpoint:checkpoint_management",
"//tensorflow/python/data/ops:dataset_ops",
"//tensorflow/python/distribute/cluster_resolver:tpu_cluster_resolver_py",
"//tensorflow/python/eager:backprop",
"//tensorflow/python/eager:context",
"//tensorflow/python/eager:def_function",
"//tensorflow/python/framework:config",
"//tensorflow/python/framework:constant_op",
"//tensorflow/python/framework:errors",
"//tensorflow/python/framework:ops",
"//tensorflow/python/module",
"//tensorflow/python/ops:array_ops",
"//tensorflow/python/ops:array_ops_stack",
"//tensorflow/python/ops:collective_ops",
"//tensorflow/python/ops:control_flow_switch_case",
"//tensorflow/python/ops:math_ops",
"//tensorflow/python/ops:stateful_random_ops",
"//tensorflow/python/ops:variables",
"//tensorflow/python/platform:client_testlib",
"//tensorflow/python/saved_model:load",
"//tensorflow/python/saved_model:save",
"//tensorflow/python/util:nest",
"@absl_py//absl/testing:parameterized",
],
)