Skip to content

Commit

Permalink
Simplify tracing computations, part #1.
Browse files Browse the repository at this point in the history
These three CLs are stacked on top of each other and they make the tracing logic more complex. Rolling these CLs back will simplify tracing logic and improve static analysis and lint. The stacktraces will have more depth, but hopefully they will also be more clear as well.

1. Revert b82dd1a - Refactors the computation wrapper to allow for non-tracing strategies.
2. Revert 827f21e - Remove the remaining TFF stack frames from tracing errors.
4. Revert 1406a91 - Invert control of some tracing functions to shorten stacktraces.

PiperOrigin-RevId: 568323122
  • Loading branch information
michaelreneer authored and tensorflow-copybara committed Sep 27, 2023
1 parent 97ced95 commit 5feb03b
Show file tree
Hide file tree
Showing 18 changed files with 581 additions and 625 deletions.
2 changes: 1 addition & 1 deletion docs/design/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Note: Using `Struct` as a single data structure to represent both Python `args`
and `kwargs` is the reason that `Struct` accepts both named and unnamed fields.

See
[function_utils.create_argument_unpacking_fn](https://github.com/tensorflow/federated/blob/main/tensorflow_federated/python/core/impl/computation/function_utils.py)
[function_utils.wrap_as_zero_or_one_arg_callable](https://github.com/tensorflow/federated/blob/main/tensorflow_federated/python/core/impl/computation/function_utils.py)
for more information.

### Tracing the function
Expand Down
6 changes: 1 addition & 5 deletions tensorflow_federated/python/core/impl/computation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ py_library(
srcs = ["computation_wrapper.py"],
deps = [
":computation_impl",
":function_utils",
":polymorphic_computation",
"//tensorflow_federated/python/common_libs:py_typecheck",
"//tensorflow_federated/python/common_libs:structure",
Expand All @@ -112,14 +111,11 @@ py_test(
size = "small",
srcs = ["computation_wrapper_test.py"],
deps = [
":computation_impl",
":computation_wrapper",
"//tensorflow_federated/proto/v0:computation_py_pb2",
"//tensorflow_federated/python/common_libs:structure",
":function_utils",
"//tensorflow_federated/python/core/impl/context_stack:context_base",
"//tensorflow_federated/python/core/impl/context_stack:context_stack_impl",
"//tensorflow_federated/python/core/impl/types:computation_types",
"//tensorflow_federated/python/core/impl/types:type_serialization",
],
)

Expand Down
318 changes: 112 additions & 206 deletions tensorflow_federated/python/core/impl/computation/computation_wrapper.py

Large diffs are not rendered by default.

Loading

0 comments on commit 5feb03b

Please sign in to comment.