aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/eager
Commit message (Collapse)AuthorAge
* Make defun work under distributed strategies.Gravatar Igor Ganichev2018-10-09
| | | | | | | | | | | | | 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
* Improves tf.function prototype.Gravatar Alexandre Passos2018-10-09
| | | | | | | | | | 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
* Throw error when evaluating have variable target in GradientTape.Gravatar Tamara Norman2018-10-09
| | | | PiperOrigin-RevId: 216368178
* Ignore args and kwargs for defun's get_concrete_fn if `PolymorphicFunction` ↵Gravatar Shivani Agrawal2018-10-08
| | | | | | | | was created with an input_signature. PiperOrigin-RevId: 216253122
* Partial support tfe.defun in tf.gradients.Gravatar Alexandre Passos2018-10-08
| | | | | | | | 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
* Merge pull request #21658 from lowintelligence:masterGravatar TensorFlower Gardener2018-10-08
|\ | | | | | | PiperOrigin-RevId: 216217509
* | Allow TensorSpec objects as arguments to defun's get_concrete_functionGravatar Allen Lavoie2018-10-08
| | | | | | | | | | | | Will be helpful for specifying serving signatures when exporting SavedModels PiperOrigin-RevId: 216207284
* | Remove Raises documentation on imperative_grads for ValueErrror not raised.Gravatar A. Unique TensorFlower2018-10-08
| | | | | | | | PiperOrigin-RevId: 216201714
* | Add the plumbing for an autograph flag to defun. Disabled and experimental ↵Gravatar Dan Moldovan2018-10-05
| | | | | | | | | | | | for now. PiperOrigin-RevId: 216003028
* | Orders non-resource-affecting stateful ops in defuns.Gravatar Alexandre Passos2018-10-05
| | | | | | | | PiperOrigin-RevId: 215985679
* | Make gradient tape stack thread localGravatar Igor Ganichev2018-10-05
| | | | | | | | PiperOrigin-RevId: 215937618
* | Pin ops with small integer inputs (already on the cpu) to the cpu in eager.Gravatar Akshay Modi2018-10-04
| | | | | | | | | | | | 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
* | This CL fixes a bug in the eager benchmarks test that caused the defun tests ↵Gravatar A. Unique TensorFlower2018-10-04
| | | | | | | | | | | | to execute a different-sized matrix multiply than the eager tests. PiperOrigin-RevId: 215814346
* | Avoid creating control edges on not-this-graph.Gravatar Alexandre Passos2018-10-04
| | | | | | | | PiperOrigin-RevId: 215811680
* | Add a separator between shape and dtype in cache key encoding.Gravatar Akshay Modi2018-10-04
| | | | | | | | | | | | 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
* | Some tiny speed improvements for defun.Gravatar Akshay Modi2018-10-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Automated rollback of commit b7e9cbab27c893283acc4a6154d7a59dffb23758Gravatar Derek Murray2018-10-02
| | | | | | | | PiperOrigin-RevId: 215503549
* | Use `defun` instead of `Defun` for `tf.data`, except for ↵Gravatar Shivani Agrawal2018-10-02
| | | | | | | | | | | | `make_one_shot_iterator` which is to be deprecated in future. PiperOrigin-RevId: 215491729
* | Don't generate backward function and delete when its not necessaryGravatar Akshay Modi2018-10-01
| | | | | | | | PiperOrigin-RevId: 215288224
* | Drop external control dependencies in tfe.defun.Gravatar Alexandre Passos2018-10-01
| | | | | | | | | | | | | | They shouldn't help given the automatic control dependencies, and are tricky to capture in the general case. PiperOrigin-RevId: 215282837
* | Minor speed improvements to defun.Gravatar Akshay Modi2018-10-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* | Add new attributes for the defun forward/backward functions.Gravatar Scott Zhu2018-10-01
| | | | | | | | PiperOrigin-RevId: 215255826
* | Move TPU variables to the TPU device in TPUStrategy.Gravatar Jonathan Hseu2018-09-28
| | | | | | | | PiperOrigin-RevId: 215027511
* | Update function registration with both inference function and ↵Gravatar Scott Zhu2018-09-27
| | | | | | | | | | | | forward/backward function pair. PiperOrigin-RevId: 214847027
| * Merge remote-tracking branch 'origin'Gravatar Cao Zongyan2018-09-26
| |\ | |/ |/|
* | PolymorphicFunction cache key is changed to use the init graph instead of ↵Gravatar Katherine Wu2018-09-24
| | | | | | | | | | | | the default graph in the scope. PiperOrigin-RevId: 214345046
* | Wrap forward and backward pass in a defun for L2HMC.Gravatar Akshay Modi2018-09-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Move from deprecated self.test_session() to self.cached_session().Gravatar A. Unique TensorFlower2018-09-24
| | | | | | | | | | | | | | | | 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
* | Clean-up of function.py.Gravatar Lasse Espeholt2018-09-24
| | | | | | | | PiperOrigin-RevId: 214232622
* | Prototype for the functions-not-sessions implementation.Gravatar Alexandre Passos2018-09-21
| | | | | | | | PiperOrigin-RevId: 214065999
* | Copy Tensor._handle_data from external_capture to placeholder for Variant ↵Gravatar Saurabh Saxena2018-09-19
| | | | | | | | | | | | | | | | | | | | 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
* | Allow the tape tensor to have unknown shapes.Gravatar Akshay Modi2018-09-19
| | | | | | | | | | | | This is done by making the TapeTensor a template rather than a concrete struct. PiperOrigin-RevId: 213700425
* | First commit for functional while loop.Gravatar Saurabh Saxena2018-09-18
| | | | | | | | | | | | | | | | Supports single and double derivatives but does not supporting nesting yet. https://github.com/tensorflow/community/pull/13 PiperOrigin-RevId: 213565971
* | Update the grappler plugin to support the @defun generated function and ops.Gravatar Scott Zhu2018-09-18
| | | | | | | | PiperOrigin-RevId: 213554813
* | Only start_step/end_step on GradientTape if executing eagerly.Gravatar Alexandre Passos2018-09-18
| | | | | | | | | | | | This prevents creating a context where none is required. PiperOrigin-RevId: 213500408
* | Num elements fastpath for eager tensors.Gravatar Akshay Modi2018-09-17
| | | | | | | | PiperOrigin-RevId: 213377426
* | Remove some dead code after migration from python to C.Gravatar Akshay Modi2018-09-17
| | | | | | | | PiperOrigin-RevId: 213372027
* | Keep only weak references to variables in graph functionsGravatar Allen Lavoie2018-09-17
| | | | | | | | | | | | | | | | 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
* | Add missing `watch` call to GradientTape documentation.Gravatar Akshay Agrawal2018-09-17
| | | | | | | | PiperOrigin-RevId: 213326503
* | GradientTape: Documentation formatting tweak.Gravatar Asim Shankar2018-09-17
| | | | | | | | PiperOrigin-RevId: 213318051
* | Make accessed variable ordering deterministic again when constructing defunsGravatar Allen Lavoie2018-09-14
| | | | | | | | PiperOrigin-RevId: 213074939
* | Makes tf.Variable arguments (non-captured) DT_RESOURCE function inputs.Gravatar Akshay Agrawal2018-09-14
| | | | | | | | | | | | 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
* | Fix bug preventing one from not specifying additional function attributes.Gravatar Lasse Espeholt2018-09-14
| | | | | | | | PiperOrigin-RevId: 212989480
* | No segfault in GradientTape with partially unknown shapes.Gravatar Alexandre Passos2018-09-13
| | | | | | | | PiperOrigin-RevId: 212876876
* | Allow user to the pre register a defun function into graph without calling it.Gravatar Scott Zhu2018-09-13
| | | | | | | | PiperOrigin-RevId: 212872452
* | eager: Graceful failure on invalid inputs.Gravatar Asim Shankar2018-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use WeakKeyDictionaries for global Keras {graph->...} mapsGravatar Igor Ganichev2018-09-12
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | Update defun to support extra params as function attributes.Gravatar Scott Zhu2018-09-11
| | | | | | | | PiperOrigin-RevId: 212517784
* | Convert NumPy arrays to Tensors when they're arguments to a defunGravatar Allen Lavoie2018-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Merge remote-tracking branch 'origin'Gravatar Cao Zongyan2018-09-11
| |\ | |/ |/|