aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/python/eager/context.py
Commit message (Collapse)AuthorAge
* Include an elements limit for cached tensors in the _TensorCacheGravatar Akshay Modi2018-08-30
| | | | | | Fixes #20218 PiperOrigin-RevId: 211010451
* Expose default execution mode as a public symbol in context.Gravatar Tom Hennigan2018-08-29
| | | | PiperOrigin-RevId: 210703993
* Replace `get_default_context()` with `context()`.Gravatar Tom Hennigan2018-08-28
| | | | PiperOrigin-RevId: 210501378
* Remove some useless pylint statements.Gravatar Tom Hennigan2018-08-27
| | | | PiperOrigin-RevId: 210373905
* Remove usage of magic-api-link syntax from source files.Gravatar Mark Daoust2018-08-09
| | | | | | | | | | | | | | | | | | | | Back-ticks are now converted to links in the api_docs generator. With the new docs repo we're moving to simplify the docs pipeline, and make everything more readable. By doing this we no longer get test failures for symbols that don't exist (`tf.does_not_exist` will not get a link). There is also no way, not to set custom link text. That's okay. This is the result of the following regex replacement (+ a couple of manual edits.): re: @\{([^$].*?)(\$.+?)?} sub: `\1` Which does the following replacements: "@{tf.symbol}" --> "`tf.symbol`" "@{tf.symbol$link_text}" --> "`tf.symbol`" PiperOrigin-RevId: 208042358
* Support keep alive so we can reclaim memory in the remote case.Gravatar Akshay Modi2018-08-08
| | | | PiperOrigin-RevId: 207971672
* Allows differentiating tfe.defun functions with loops in eager mode.Gravatar Alexandre Passos2018-08-08
| | | | | | | | | | | Adopts a minimal sensible policy for step containers: starting a graident tape creates a step container; inner tapes do nothing; popping out of the outermost tape will reset that step container. This should allow us to have reasonable behavior in the presence of step-container-scoped things for a while. Ideally we'll move away from them in favor of lists but the infrastructure isn't ready yet. PiperOrigin-RevId: 207911091
* Allow setting server_def directly on TFE_Context.Gravatar Akshay Modi2018-08-03
| | | | | | | | | Any time that the server def is updated, the context is effectively "reset" by clearing all the caches. - Check that the FLR returned is not a nullptr instead of seg faulting. - Consolidate caches within the context object. PiperOrigin-RevId: 207308086
* Push tensors from client to workers.Gravatar Akshay Modi2018-07-24
| | | | | | | | | | | At times, a server cannot open a reverse connection to the client. This is required when using the _Send/_Recv ops and the client needs to send a tensor to the server (tensors are pulled). Instead, this adds a way to push the tensors directly from the client. Currently, pushing tensors always happens in sync mode. PiperOrigin-RevId: 205888825
* Allow setting server def on the eager context, and add the eager service to ↵Gravatar Akshay Modi2018-06-19
| | | | | | the grpc_tensorflow_server. PiperOrigin-RevId: 201198350
* Apply "Raise exception in SWIG on bad TF_Status" to base.iGravatar Akshay Modi2018-04-03
| | | | | | Minor fixes to make this work. PiperOrigin-RevId: 191457070
* Reduce overhead for eager opsGravatar Akshay Modi2018-04-02
| | | | | | | | | | | | | | | | | | | | | | - Call _context_handle in the fastpath. Fall back to slow path if it is not initialized. A better fix would be to not initialize handle and devices lazily (and not have to pay that function call in the slow path either), but that seems to break all GPU/TPU tests. I'm not as yet really familiar with how devices are recognized, but I'd be happy to hear any ideas you may have to fix this. - context.context() is monkey patched to remove the "is None" check once we know the context is correctly initialized. Ideally we would be able to remove this function call as well. - Maintain is_eager instead of doing the comparison every time. Also, in the fastpath, inline the check directly instead of paying the function call cost. - Inline _eager_context.device_name instead of get the device_name property to not pay the function call cost gen_array_ops.identity Old: 216706.923837 examples/sec (4.61452722549) gen_array_ops.identity New: 290819.129714 examples/sec (3.43856334686) PiperOrigin-RevId: 191336857
* Raise exception in SWIG on bad TF_Status from C API.Gravatar Skye Wanderman-Milne2018-03-30
| | | | | | | | | | | | | | | This change provides an alternative mechanism to tf.raise_exception_on_not_ok_status(), which is inefficient and error-prone (people often use the status multiple times in the with block, but it's only checked when the context manager exits). Instead, it uses SWIG to automatically raise an exception when a C API method fails. Note that this removes the status argument from affected methods. For now, I've only applied this typemap to C API methods. It would be good to expand this to all uses of raise_exception_on_not_ok_status. PiperOrigin-RevId: 191121016
* Pass options to TFE_ContextOptionsSetAsyncGravatar Akshay Modi2018-03-27
| | | | PiperOrigin-RevId: 190707017
* TFE: Modify initialization of `ContextStack` to ensure eager context is kept.Gravatar Akshay Agrawal2018-03-15
| | | | | | | | | | | When eager execution is enabled in the main thread, the fact that it was enabled is propagated to subsequently created threads. This change ... (1) ensures that the fact that eager was enabled is also propagated to the `ContextStack`, which is renamed to `_ContextSwitchStack`, for clarity; (2) adds a `_ContextSwitchStack` object to `Context` as a member, removing the global `context_stack`. PiperOrigin-RevId: 189206207
* Enable async eager mode in python. Add some benchmarks.Gravatar A. Unique TensorFlower2018-03-14
| | | | PiperOrigin-RevId: 189101670
* eager: Export tf.enable_eager_execution() and tf.executing_eagerly()Gravatar Asim Shankar2018-03-07
| | | | PiperOrigin-RevId: 188255674
* eager: Rename in_eager_mode to executing_eagerly and get rid of in_graph_mode.Gravatar Asim Shankar2018-03-07
| | | | | | | | This is in preparation to introduce one public, stable symbol: tf.executing_eagerly() (i.e., part of moving APIs related to eager execution from "contrib" to a namespace where we provide API stability guarantees) PiperOrigin-RevId: 188212646
* Improvement to eager linear regression benchmarkGravatar Akshay Modi2018-03-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: entry { name: "EagerLinearRegressionBenchmark.eager_train_cpu" iters: 2000 wall_time: 2.45178794861 extras { key: "examples_per_sec" value { double_value: 52206.7987456 } } } After: entry { name: "EagerLinearRegressionBenchmark.eager_train_cpu" iters: 2000 wall_time: 1.9873790741 extras { key: "examples_per_sec" value { double_value: 64406.4344182 } } } PiperOrigin-RevId: 188068838
* Improvement to the eager device placement heuristic.Gravatar Alexandre Passos2018-02-23
| | | | PiperOrigin-RevId: 186833677
* Initializing the thread-local device to the right value.Gravatar Alexandre Passos2018-02-16
| | | | PiperOrigin-RevId: 186062850
* Add python/util/is_in_graph_mode.pyGravatar A. Unique TensorFlower2018-02-10
| | | | PiperOrigin-RevId: 185260675
* Silent copies for int32 tensors in TFE.Gravatar Alexandre Passos2018-01-24
| | | | | | Fixes #16106 PiperOrigin-RevId: 183137298
* tf_contextlib forgotten oopsGravatar Alexandre Passos2018-01-24
| | | | PiperOrigin-RevId: 183126126
* Initializes the context before setting the device policyGravatar Alexandre Passos2018-01-24
| | | | PiperOrigin-RevId: 183126037
* Allow setting per-thread device copying policies in TFE.Gravatar Alexandre Passos2018-01-24
| | | | PiperOrigin-RevId: 183093407
* Initialize context handle before enable_run_metadata.Gravatar A. Unique TensorFlower2018-01-12
| | | | PiperOrigin-RevId: 181770918
* Exposes runmetadata from tfe in python.Gravatar Alexandre Passos2018-01-09
| | | | PiperOrigin-RevId: 181317960
* Clear eager kernel cache when resetting random seed.Gravatar Alexandre Passos2018-01-05
| | | | | | "big hammer" required for reproducibility. PiperOrigin-RevId: 180961787
* Add `init_scope`, a scope for wrapping variable creation and initialization.Gravatar Akshay Agrawal2017-12-14
| | | | | | | | | | | | | | | | | | | | | | | | | | There is often a need to lift variable initialization ops out of control flow contexts, graphs that are building functions, and gradient tapes. Entering an `init_scope` is a mechanism for satisfying these desiderata. In particular, entering an `init_scope` has three effects: (1) All control dependencies are cleared the moment the scope is entered; this is equivalent to entering the manager returned from `control_dependencies(None)`, which is how we exit control-flow contexts like `tf.while_loop` and `tf.cond`. (2) All operations that are created while the scope is active are lifted into the lowest context on the `context_stack` that is not building a graph function. (3) The gradient tape is paused while the scope is active. In (2), a context is defined as either a graph or an eager context. Every context switch, i.e., every installation of a graph as the default graph and every switch into eager mode, is logged in a thread-local stack called the `context_stack`; the log entry for a context switch is popped from the stack when the context is exited. Entering an `init_scope`, with respect to (2), is equivalent to crawling up the `context_stack`, finding the first context that is not building a graph function, and entering it. PiperOrigin-RevId: 179104270
* Uses C API for eager functions.Gravatar Alexandre Passos2017-11-30
| | | | | | Rolls back the rollback with some swiggery to get python3 to work. PiperOrigin-RevId: 177470328
* Automated g4 rollback of changelist 177375237Gravatar Gunhan Gulsoy2017-11-30
| | | | PiperOrigin-RevId: 177418947
* Using the C API in eager mode for graph functions.Gravatar Alexandre Passos2017-11-29
| | | | PiperOrigin-RevId: 177375237
* Switching contrib.summaries API to be context-manager-centricGravatar Alexandre Passos2017-10-23
| | | | PiperOrigin-RevId: 173129793
* Allows tfe.enable_eager_execution(device_policy=tfe.DEVICE_POLICY_WARN).Gravatar Alexandre Passos2017-10-20
| | | | PiperOrigin-RevId: 172943398
* Context-specific C API to set options other than configproto (still unused)Gravatar Alexandre Passos2017-10-19
| | | | PiperOrigin-RevId: 172818175
* tfe.enable_eager_execution fails only if graphs have been created.Gravatar Alexandre Passos2017-10-19
| | | | | | It is otherwise idempotent. PiperOrigin-RevId: 172757241
* Improve Eager mode random numbers.Gravatar A. Unique TensorFlower2017-10-10
| | | | PiperOrigin-RevId: 171698189
* eager: Compute num_gpus() correctly.Gravatar Asim Shankar2017-10-06
| | | | | | | | Without this change, if TensorFlow is compiled with support for other devices (such with XLA, which makes XLA_CPU and XLA_GPU devices available), then tfe.num_gpus() was incorrectly overcounting the number of available GPUs. PiperOrigin-RevId: 171373389
* Move EagerTensor from python to C.Gravatar A. Unique TensorFlower2017-09-30
| | | | PiperOrigin-RevId: 170617321
* TFE: Add Python code examples in doc strings and make existing ones executableGravatar Shanqing Cai2017-09-18
| | | | | | Also, move some TODO items out of doc strings of public methods. PiperOrigin-RevId: 169094945
* TFE: Clearer error message when enable_eager_execution is called more than onceGravatar Shanqing Cai2017-09-15
| | | | PiperOrigin-RevId: 168834147
* Comment and error message consistency cleanup.Gravatar Henry Tan2017-09-12
| | | | PiperOrigin-RevId: 168422582
* TFE: expose tfe.num_gpus()Gravatar Shanqing Cai2017-09-10
| | | | PiperOrigin-RevId: 168154345
* Scope the scalar cache in the context.Gravatar Alexandre Passos2017-09-08
| | | | PiperOrigin-RevId: 168065417
* eager: Move "register_function" to context.pyGravatar Asim Shankar2017-09-08
| | | | | | | | This will allow function registration from other modules without having to import "function.py". (And besides, the function really does belong on the context). PiperOrigin-RevId: 168040411
* TFE: Fix an issue wherein tfe.list_device() didn't workGravatar Shanqing Cai2017-09-08
| | | | | | The function errorred out because the undocumented name "context" was removed in tfe.py. PiperOrigin-RevId: 168021533
* Optimize tf.device in Eager mode by caching to avoid repeated device specGravatar A. Unique TensorFlower2017-09-07
| | | | | | merging. PiperOrigin-RevId: 167912007
* Contrib ops and kernels for summary ops which write without touching python.Gravatar Alexandre Passos2017-09-01
| | | | PiperOrigin-RevId: 167340103
* Internal changes.Gravatar Shanqing Cai2017-08-21
| | | | PiperOrigin-RevId: 165951046