FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge commit for internal changes. · codeplaysoftware/tensorflow@f8d7553 · GitHub

Merge commit for internal changes. · codeplaysoftware/tensorflow@f8d7553 · GitHub
Skip to content

Navigation Menu

Repository navigation

Commit f8d7553

Browse files
Patrick Nguyen
committed
Merge commit for internal changes.
2 parents adf0456 + 43a7072 commit f8d7553

571 files changed

Lines changed: 22725 additions & 10319 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎tensorflow/c/eager/BUILD‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ tf_cuda_library(
4040
"//tensorflow/core:lib",
4141
"//tensorflow/core:lib_internal",
4242
"//tensorflow/core:protos_all_cc",
43-
# TODO(b/74620627): move this here
44-
"//tensorflow/python:cpp_shape_inference_proto_cc",
4543
],
4644
}) + select({
4745
"//tensorflow:with_xla_support": [

‎tensorflow/c/eager/c_api.cc‎

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ limitations under the License.
4848
#include "tensorflow/core/platform/mutex.h"
4949
#include "tensorflow/core/platform/thread_annotations.h"
5050
#include "tensorflow/core/public/version.h"
51-
#include "tensorflow/python/framework/cpp_shape_inference.pb.h"
5251

5352
using tensorflow::int64;
5453
using tensorflow::string;
@@ -503,62 +502,6 @@ void TFE_ContextExportRunMetadata(TFE_Context* ctx, TF_Buffer* buf,
503502
ctx->context.RunMetadataProto()->Clear();
504503
}
505504

506-
void TFE_GetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output,
507-
TF_Buffer* output_proto,
508-
TF_Status* status) {
509-
tensorflow::Node* node = &output.oper->node;
510-
tensorflow::CppShapeInferenceResult::HandleData handle_data;
511-
handle_data.set_is_set(true);
512-
{
513-
tensorflow::mutex_lock l(graph->mu);
514-
tensorflow::shape_inference::InferenceContext* ic =
515-
graph->refiner.GetContext(node);
516-
CHECK(ic != nullptr);
517-
CHECK_LT(output.index, ic->num_outputs());
518-
const auto* shapes_and_types =
519-
ic->output_handle_shapes_and_types(output.index);
520-
if (shapes_and_types == nullptr) {
521-
output_proto->data = nullptr;
522-
output_proto->length = 0;
523-
output_proto->data_deallocator = nullptr;
524-
return;
525-
}
526-
527-
for (const auto& p : *shapes_and_types) {
528-
auto* out_shape_and_type = handle_data.add_shape_and_type();
529-
ic->ShapeHandleToProto(p.shape, out_shape_and_type->mutable_shape());
530-
out_shape_and_type->set_dtype(p.dtype);
531-
}
532-
}
533-
status->status = MessageToBuffer(handle_data, output_proto);
534-
}
535-
536-
void TFE_SetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output,
537-
const void* proto, size_t proto_len,
538-
TF_Status* status) {
539-
tensorflow::CppShapeInferenceResult::HandleData handle_data;
540-
if (!handle_data.ParseFromArray(proto, proto_len)) {
541-
status->status = tensorflow::errors::InvalidArgument(
542-
"Couldn't deserialize HandleData proto");
543-
return;
544-
}
545-
DCHECK(handle_data.is_set());
546-
547-
tensorflow::mutex_lock l(graph->mu);
548-
tensorflow::shape_inference::InferenceContext* ic =
549-
graph->refiner.GetContext(&output.oper->node);
550-
551-
std::vector<tensorflow::shape_inference::ShapeAndType> shapes_and_types;
552-
for (const auto& shape_and_type_proto : handle_data.shape_and_type()) {
553-
tensorflow::shape_inference::ShapeHandle shape;
554-
status->status =
555-
ic->MakeShapeFromShapeProto(shape_and_type_proto.shape(), &shape);
556-
if (status->status.ok()) return;
557-
shapes_and_types.emplace_back(shape, shape_and_type_proto.dtype());
558-
}
559-
ic->set_output_handle_shapes_and_types(output.index, shapes_and_types);
560-
}
561-
562505
namespace {
563506
TFE_Op* GetFunc(TFE_Context* ctx, const tensorflow::NameAttrList& func,
564507
TF_Status* status) {

‎tensorflow/c/eager/c_api.h‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,6 @@ TF_CAPI_EXPORT extern void TFE_ContextExportRunMetadata(TFE_Context* ctx,
329329
TF_Buffer* buf,
330330
TF_Status* status);
331331

332-
// Returns the serialized CppShapeInferenceResult::HandleData proto for
333-
// `output` if its a resource tensor, or otherwise returns an empty buffer.
334-
TF_CAPI_EXPORT extern void TFE_GetResourceHandleShapeAndType(
335-
TF_Graph* graph, TF_Output output, TF_Buffer* output_proto,
336-
TF_Status* status);
337-
338-
// Sets `output` based on `proto`, which should be a serialized
339-
// CppShapeInferenceResult::HandleData proto.
340-
TF_CAPI_EXPORT extern void TFE_SetResourceHandleShapeAndType(TF_Graph* graph,
341-
TF_Output output,
342-
const void* proto,
343-
size_t proto_len,
344-
TF_Status* status);
345-
346332
#ifdef __cplusplus
347333
} /* end extern "C" */
348334
#endif

‎tensorflow/c/python_api.cc‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void ExtendSession(TF_Session* session, TF_Status* status) {
110110
session->extend_before_run = false;
111111
}
112112

113-
std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output) {
113+
std::string GetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output) {
114114
Node* node = &output.oper->node;
115115
CppShapeInferenceResult::HandleData handle_data;
116116
handle_data.set_is_set(true);
@@ -135,4 +135,30 @@ std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output) {
135135
return result;
136136
}
137137

138+
void SetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output,
139+
const void* proto, size_t proto_len,
140+
TF_Status* status) {
141+
tensorflow::CppShapeInferenceResult::HandleData handle_data;
142+
if (!handle_data.ParseFromArray(proto, proto_len)) {
143+
status->status = tensorflow::errors::InvalidArgument(
144+
"Couldn't deserialize HandleData proto");
145+
return;
146+
}
147+
DCHECK(handle_data.is_set());
148+
149+
tensorflow::mutex_lock l(graph->mu);
150+
tensorflow::shape_inference::InferenceContext* ic =
151+
graph->refiner.GetContext(&output.oper->node);
152+
153+
std::vector<tensorflow::shape_inference::ShapeAndType> shapes_and_types;
154+
for (const auto& shape_and_type_proto : handle_data.shape_and_type()) {
155+
tensorflow::shape_inference::ShapeHandle shape;
156+
status->status =
157+
ic->MakeShapeFromShapeProto(shape_and_type_proto.shape(), &shape);
158+
if (status->status.ok()) return;
159+
shapes_and_types.emplace_back(shape, shape_and_type_proto.dtype());
160+
}
161+
ic->set_output_handle_shapes_and_types(output.index, shapes_and_types);
162+
}
163+
138164
} // namespace tensorflow

‎tensorflow/c/python_api.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ void ExtendSession(TF_Session* session, TF_Status* status);
5555

5656
// Returns the serialized CppShapeInferenceResult::HandleData proto for
5757
// `output` if its a resource tensor, or otherwise returns the empty string.
58-
// TODO(b/74620627): remove when _USE_C_SHAPES is removed
59-
std::string ResourceHandleShapeAndType(TF_Graph* graph, TF_Output output);
60-
58+
std::string GetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output);
59+
60+
// Sets `output` based on `proto`, which should be a serialized
61+
// CppShapeInferenceResult::HandleData proto.
62+
// NOTE(skyewm): `proto` is passed a void*/size_t pair instead of a std::string
63+
// because I couldn't get SWIG to work otherwise.
64+
void SetResourceHandleShapeAndType(TF_Graph* graph, TF_Output output,
65+
const void* proto, size_t proto_len,
66+
TF_Status* status);
6167
} // namespace tensorflow
6268

6369
#endif // TENSORFLOW_C_PYTHON_API_H_

‎tensorflow/compiler/aot/compile.cc‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,8 @@ Status CompileGraph(const GraphDef& graph_def, const tf2xla::Config& config,
8888
// Converts the graph into an XLA computation, and compiles the
8989
// computation.
9090
// TODO(toddw): Should we let the user pick the XLA cpu vs. gpu client?
91-
namespace gpu = perftools::gputools;
92-
gpu::Platform* cpu_platform =
93-
gpu::MultiPlatformManager::PlatformWithName("Host").ValueOrDie();
91+
se::Platform* cpu_platform =
92+
se::MultiPlatformManager::PlatformWithName("Host").ValueOrDie();
9493
xla::CompileOnlyClient* client =
9594
xla::ClientLibrary::GetOrCreateCompileOnlyClient(cpu_platform)
9695
.ValueOrDie();

‎tensorflow/compiler/aot/test.cc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ limitations under the License.
3535
// clang-format on
3636

3737
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
38+
#include "tensorflow/core/platform/byte_order.h"
3839
#include "tensorflow/core/platform/cpu_info.h"
3940
#include "tensorflow/core/platform/test.h"
4041
#include "tensorflow/core/platform/test_benchmark.h"

‎tensorflow/compiler/jit/BUILD‎

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ cc_library(
180180
"//tensorflow/core/kernels:no_op",
181181
"//tensorflow/core/kernels:sendrecv_ops",
182182
"//tensorflow/core/kernels:variable_ops",
183+
"@com_google_absl//absl/memory",
183184
],
184185
)
185186

@@ -256,19 +257,6 @@ cc_library(
256257
alwayslink = 1,
257258
)
258259

259-
cc_library(
260-
name = "graph_to_functiondef",
261-
srcs = ["graph_to_functiondef.cc"],
262-
hdrs = ["graph_to_functiondef.h"],
263-
visibility = [":friends"],
264-
deps = [
265-
"//tensorflow/core:core_cpu",
266-
"//tensorflow/core:framework",
267-
"//tensorflow/core:lib",
268-
"//tensorflow/core:protos_all_cc",
269-
],
270-
)
271-
272260
cc_library(
273261
name = "create_xla_launch_op",
274262
srcs = [
@@ -299,7 +287,6 @@ cc_library(
299287
],
300288
deps = [
301289
":common",
302-
":graph_to_functiondef",
303290
":shape_inference_helpers",
304291
":union_find",
305292
"//tensorflow/compiler/jit/graphcycles",
@@ -346,28 +333,6 @@ tf_cc_test(
346333
],
347334
)
348335

349-
tf_cc_test(
350-
name = "graph_to_functiondef_test",
351-
size = "small",
352-
srcs = [
353-
"graph_to_functiondef_test.cc",
354-
],
355-
deps = [
356-
":graph_to_functiondef",
357-
"//tensorflow/cc:cc_ops",
358-
"//tensorflow/cc:cc_ops_internal",
359-
"//tensorflow/cc:function_ops",
360-
"//tensorflow/cc:ops",
361-
"//tensorflow/compiler/tf2xla:xla_compiler",
362-
"//tensorflow/compiler/tf2xla/kernels:xla_ops",
363-
"//tensorflow/core:core_cpu",
364-
"//tensorflow/core:framework_internal",
365-
"//tensorflow/core:test",
366-
"//tensorflow/core:test_main",
367-
"//tensorflow/core:testlib",
368-
],
369-
)
370-
371336
tf_cc_test(
372337
name = "compilation_passes_test",
373338
size = "small",
@@ -378,7 +343,6 @@ tf_cc_test(
378343
deps = [
379344
":common",
380345
":compilation_passes",
381-
":graph_to_functiondef",
382346
"//tensorflow/cc:cc_ops",
383347
"//tensorflow/cc:cc_ops_internal",
384348
"//tensorflow/cc:function_ops",

‎tensorflow/compiler/jit/encapsulate_subgraphs_pass.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ limitations under the License.
2222
#include <unordered_map>
2323
#include <vector>
2424

25-
#include "tensorflow/compiler/jit/graph_to_functiondef.h"
2625
#include "tensorflow/compiler/jit/graphcycles/graphcycles.h"
2726
#include "tensorflow/compiler/jit/legacy_flags/encapsulate_subgraphs_pass_flags.h"
2827
#include "tensorflow/compiler/jit/mark_for_compilation_pass.h"
@@ -35,6 +34,7 @@ limitations under the License.
3534
#include "tensorflow/core/common_runtime/shape_refiner.h"
3635
#include "tensorflow/core/framework/function.h"
3736
#include "tensorflow/core/framework/graph_def_util.h"
37+
#include "tensorflow/core/framework/graph_to_functiondef.h"
3838
#include "tensorflow/core/framework/node_def_builder.h"
3939
#include "tensorflow/core/framework/node_def_util.h"
4040
#include "tensorflow/core/graph/algorithm.h"

‎tensorflow/compiler/jit/encapsulate_subgraphs_pass_test.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ limitations under the License.
2020

2121
#include "tensorflow/cc/framework/ops.h"
2222
#include "tensorflow/cc/ops/standard_ops.h"
23-
#include "tensorflow/compiler/jit/graph_to_functiondef.h"
2423
#include "tensorflow/core/framework/function_testlib.h"
24+
#include "tensorflow/core/framework/graph_to_functiondef.h"
2525
#include "tensorflow/core/graph/graph_constructor.h"
2626
#include "tensorflow/core/graph/graph_def_builder.h"
2727
#include "tensorflow/core/lib/core/status_test_util.h"

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL