| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The core of the change is have the gradient tape capture
distributed variables instead of plain ResourceVariables.
In other words, we move the distribution awareness from defun
down to tape and rely on distributed variable magic to provide us
with the right variable at runtime.
In tower context, we always watch the container (e.g. MirroredVariable).
In cross tower context, we always watch all the components.
PiperOrigin-RevId: 216430530
|
|
|
|
|
|
|
|
|
|
| |
Specifically:
- renames from def_function
- returns an object with well-defined methods
- doesn't force-retrace twice
- uses the python descriptor API ( https://docs.python.org/3/howto/descriptor.html )
to remove the need for a tf.method
PiperOrigin-RevId: 216388957
|
|
|
|
| |
PiperOrigin-RevId: 216368178
|
|
|
|
|
|
|
|
| |
was created
with an input_signature.
PiperOrigin-RevId: 216253122
|
|
|
|
|
|
|
|
| |
Doesn't attempt to deal with cases where we might have already generated
the functiondef for the parent function as in that case we cannot easily
modify the forward pass.
PiperOrigin-RevId: 216243224
|
|\
| |
| |
| | |
PiperOrigin-RevId: 216217509
|
| |
| |
| |
| |
| |
| | |
Will be helpful for specifying serving signatures when exporting SavedModels
PiperOrigin-RevId: 216207284
|
| |
| |
| |
| | |
PiperOrigin-RevId: 216201714
|
| |
| |
| |
| |
| |
| | |
for now.
PiperOrigin-RevId: 216003028
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215985679
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215937618
|
| |
| |
| |
| |
| |
| | |
An environment variable (TF_EAGER_ENABLE_SMALL_TENSOR_CPU_PINNING) is provided to turn this off if necessary (its on by default).
PiperOrigin-RevId: 215821915
|
| |
| |
| |
| |
| |
| | |
to execute a different-sized matrix multiply than the eager tests.
PiperOrigin-RevId: 215814346
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215811680
|
| |
| |
| |
| |
| |
| | |
It was possible that we could mix shapes and types (T111 could mean a tensor of dtype 1 and shape (1, 1) or a tensor of dtype 11 and shape (1)).
PiperOrigin-RevId: 215777629
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Before:
entry {
name: "MicroBenchmarks.benchmark_defun_matmul_2_by_2_CPU"
iters: 30000
wall_time: 48.4476327896
extras {
key: "examples_per_sec"
value {
double_value: 20640.8433688
}
}
}
After:
entry {
name: "MicroBenchmarks.benchmark_defun_matmul_2_by_2_CPU"
iters: 30000
wall_time: 45.2344338099
extras {
key: "examples_per_sec"
value {
double_value: 22107.0524327
}
}
}
PiperOrigin-RevId: 215619902
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215503549
|
| |
| |
| |
| |
| |
| | |
`make_one_shot_iterator` which is to be deprecated in future.
PiperOrigin-RevId: 215491729
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215288224
|
| |
| |
| |
| |
| |
| |
| | |
They shouldn't help given the automatic control dependencies, and are tricky
to capture in the general case.
PiperOrigin-RevId: 215282837
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- EncodeArg in C instead of python.
- Also caches parsed device specs, and device spec hashes
- Adds a common way to register python types in C.
- Fastpath canonicalize function inputs when no kwargs are passed
- Set the func name attr directly instead of creating an op to wrap it.
- Rewrite IsAttrsHelper without caching
Before:
entry {
name: "MicroBenchmarks.benchmark_defun_matmul_2_by_2_CPU"
iters: 30000
wall_time: 101.803263028
extras {
key: "examples_per_sec"
value {
double_value: 9822.86785562
}
}
}
After:
entry {
name: "MicroBenchmarks.benchmark_defun_matmul_2_by_2_CPU"
iters: 30000
wall_time: 47.2899993261
extras {
key: "examples_per_sec"
value {
double_value: 21146.1199884
}
}
}
PiperOrigin-RevId: 215272962
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215255826
|
| |
| |
| |
| | |
PiperOrigin-RevId: 215027511
|
| |
| |
| |
| |
| |
| | |
forward/backward function pair.
PiperOrigin-RevId: 214847027
|
| |\
| |/
|/| |
|
| |
| |
| |
| |
| |
| | |
the default graph in the scope.
PiperOrigin-RevId: 214345046
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Also a small bugfix to handle unknown shapes in backprop._num_elements.
Before:
entry {
name: "L2hmcBenchmark.eager_train_cpu_defun"
iters: 10
wall_time: 0.594115018845
extras {
key: "examples_per_sec"
value {
double_value: 336.635152548
}
}
}
After:
entry {
name: "L2hmcBenchmark.eager_train_cpu_defun"
iters: 10
wall_time: 0.322251081467
extras {
key: "examples_per_sec"
value {
double_value: 620.634069216
}
}
}
PiperOrigin-RevId: 214308142
|
| |
| |
| |
| |
| |
| |
| |
| | |
self.test_session() has been deprecated in 9962eb5e84b15e309410071b06c2ed2d6148ed44 as its name confuses readers of the test. Moving to cached_session() instead which is more explicit about:
* the fact that the session may be reused.
* the session is not closed even when doing a "with self.test_session()" statement.
PiperOrigin-RevId: 214300210
|
| |
| |
| |
| | |
PiperOrigin-RevId: 214232622
|
| |
| |
| |
| | |
PiperOrigin-RevId: 214065999
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
tensors in Graph mode defun.
This allows inferring the shape of values popped from TensorLists inside defuns.
Remove "Resource" from {Set|Get}ResourceHandleShapeAndType since the same functions are re-usable for variants.
Eager mode fix coming in a future changelist.
PiperOrigin-RevId: 213735462
|
| |
| |
| |
| |
| |
| | |
This is done by making the TapeTensor a template rather than a concrete struct.
PiperOrigin-RevId: 213700425
|
| |
| |
| |
| |
| |
| |
| |
| | |
Supports single and double derivatives but does not supporting nesting yet.
https://github.com/tensorflow/community/pull/13
PiperOrigin-RevId: 213565971
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213554813
|
| |
| |
| |
| |
| |
| | |
This prevents creating a context where none is required.
PiperOrigin-RevId: 213500408
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213377426
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213372027
|
| |
| |
| |
| |
| |
| |
| |
| | |
This enables cleanup of the variables referenced in defunned methods of objects when the object is garbage collected. Since one PolymorphicFunction is created per @defun, decorated methods before this change held on to all of the variables referenced in that method for any instance of the class (i.e. variables which should have been object-scoped were scoped to the lifetime of the class definition).
Raises an exception if variables used in the function have been deleted when it is called, which means no local variables.
PiperOrigin-RevId: 213337256
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213326503
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213318051
|
| |
| |
| |
| | |
PiperOrigin-RevId: 213074939
|
| |
| |
| |
| |
| |
| | |
Previously, tf.Variable arguments to a defun-d Python function were made captured inputs. This change makes it possible to parameterize functions on DT_RESOURCE inputs.
PiperOrigin-RevId: 213064739
|
| |
| |
| |
| | |
PiperOrigin-RevId: 212989480
|
| |
| |
| |
| | |
PiperOrigin-RevId: 212876876
|
| |
| |
| |
| | |
PiperOrigin-RevId: 212872452
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Tests added to pywrap_tfe_test.py would fail
(segmentation fault / infinite loop)
without corresponding fixes to pywrap_tfe.i and pywrap_tfe_src.cc
Other statements that would fail ungracefully without this fix
(and with eager execution enabled) include:
tf.split(value=0, num_or_size_splits=-1)
tf.dynamic_partition(data=0, partitions=0, num_partitions=-1)
tf.split(value=0, num_or_size_splits=1.23, num=-1)
tf.unstack(value=0, num=-1)
PiperOrigin-RevId: 212731927
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These globals were holding onto graphs including FuncGraphs, which
held onto captured tensors leaving garbage around.
This change also adds a test to catch garbage like this in the future.
To make the test work, I needed to manually breakup some reference
cycles caused by OrderedDicts. We should probably have a custom impl
of OrderedDict similar to the one in Python3 and avoid these issues.
PiperOrigin-RevId: 212694290
|
| |
| |
| |
| | |
PiperOrigin-RevId: 212517784
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously they were counted in the cache key as if they were Tensors, but were not fed as placeholders, leading to stale values when the trace was reused.
There is an 8%ish performance impact from the tuple comprehension on the defun no-signature-call microbenchmarks. I don't see a much faster way to do this without rewriting it in C, but I'm open to ideas. I've avoided re-packing the input tuple unless there's actually a numpy array, so this CL will slow down NumPy defun calls more (in addition to the convert_to_tensor overhead).
After:
entry {
name: "MicroBenchmarks.benchmark_defun_with_signature"
iters: 30000
wall_time: 134.219272931
extras {
key: "examples_per_sec"
value {
double_value: 7450.49483699
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_with_signature_and_kwargs"
iters: 30000
wall_time: 142.88717111
extras {
key: "examples_per_sec"
value {
double_value: 6998.52892485
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_without_signature"
iters: 30000
wall_time: 76.2096961339
extras {
key: "examples_per_sec"
value {
double_value: 13121.6898994
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_without_signature_and_with_kwargs"
iters: 30000
wall_time: 81.8309704463
extras {
key: "examples_per_sec"
value {
double_value: 12220.3121208
}
}
}
Before:
entry {
name: "MicroBenchmarks.benchmark_defun_with_signature"
iters: 30000
wall_time: 129.392266273
extras {
key: "examples_per_sec"
value {
double_value: 7728.43716862
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_with_signature_and_kwargs"
iters: 30000
wall_time: 141.65956974
extras {
key: "examples_per_sec"
value {
double_value: 7059.1771656
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_without_signature"
iters: 30000
wall_time: 70.6333637238
extras {
key: "examples_per_sec"
value {
double_value: 14157.6154282
}
}
}
entry {
name: "MicroBenchmarks.benchmark_defun_without_signature_and_with_kwargs"
iters: 30000
wall_time: 78.4090677897
extras {
key: "examples_per_sec"
value {
double_value: 12753.6269489
}
}
}
PiperOrigin-RevId: 212491803
|
| |\
| |/
|/| |
|