Commit Graph

24 Commits

Author SHA1 Message Date
Gaurav Jain
9b576164f1 Add Tensor & TensorHandle C APIs taking a Context
The existing TF_AllocateTensor & TFE_NewTensorHandle APIs do not take a
TFE_Context which is undesirable as the TFE_Context indicates ownership
of the tensor. Thus we add new APIs to super-seed the existing ones.

PiperOrigin-RevId: 305126310
Change-Id: I9863ebc692d48875c61b79197ab418f29503a8c6
2020-04-06 15:10:09 -07:00
Gaurav Jain
76764af42d Delete unused experimental APIs
PiperOrigin-RevId: 293539110
Change-Id: I1a2ab5a8a506bf2ae30966931369ae913b028d43
2020-02-06 01:02:17 -08:00
Peter Hawkins
1cd271aefb Rollback of CL that breaks JAX on TPUs in combination with TFDS.
PiperOrigin-RevId: 290848760
Change-Id: Id5168c9768e1f27d8ca1392f721bb13f8bba0416
2020-01-21 16:34:52 -08:00
Allen Lavoie
63d37de461 Automatically initialize TPUs when initializing the eager context or connecting to new jobs
Adds an experimental C API for initializing TPUs and retrieving the topology, and runs it when initializing new logical devices in the eager context.

This does mean that running tf.tpu.experimental.initialize_tpu_system double-initializes the TPU system the first time if executed eagerly (the eager context initialization will always run first). I don't think this hurts too much.

My main motivation is to get ready for a device-agnostic distribution API: no "if TPU"s and the topology is available to intermediate APIs.

PiperOrigin-RevId: 289917514
Change-Id: I5fe22ef942bbdecac105d6a3fd7b9609b2e4e7bf
2020-01-15 12:57:05 -08:00
Gaurav Jain
d15390d2c9 Remove symbolic tensor support from TensorHandle
This code is no longer being used by swift, so it seems best to
remove it to simplify the uses of TensorHandle.

PiperOrigin-RevId: 281406036
Change-Id: Ib98a84cb767fe76eee6f41d7e86c02e2eee7e98f
2019-11-19 18:48:16 -08:00
A. Unique TensorFlower
c6719f2091 Fix a memory bug in the C shape inference API.
PiperOrigin-RevId: 262171100
2019-08-07 11:42:00 -07:00
A. Unique TensorFlower
038d0cdabc Handle input_tensors in C shape inference API.
PiperOrigin-RevId: 261761496
2019-08-05 14:00:23 -07:00
A. Unique TensorFlower
6edf8c57c7 Clean up test for the shape inference so that expectations are obvious.
PiperOrigin-RevId: 261732924
2019-08-05 12:01:19 -07:00
A. Unique TensorFlower
31e2d7a157 Remove a redunant argument from the C shape inference API.
PiperOrigin-RevId: 261328055
2019-08-02 08:58:18 -07:00
A. Unique TensorFlower
b898082617 Adds an experimental C API to expose TF shape inference functions for ops.
PiperOrigin-RevId: 259639450
2019-07-23 17:03:47 -07:00
Gaurav Jain
4213d5c1bd Use absl instead of deprecated str_util
PiperOrigin-RevId: 249248716
2019-05-21 08:10:10 -07:00
A. Unique TensorFlower
6c71cb2d20 Handle number attributes correctly in AddEagerOpToGraph API.
PiperOrigin-RevId: 242544702
2019-04-08 15:01:46 -07:00
A. Unique TensorFlower
ad326ac0a3 Remove unused dataset APIs with hard coded text protos
PiperOrigin-RevId: 239268847
2019-03-19 14:47:42 -07:00
TensorFlower Gardener
4945b562f7 Merge pull request from karllessard:eager-type-attr-inference
PiperOrigin-RevId: 236185593
2019-02-28 15:39:17 -08:00
A. Unique TensorFlower
896ad1053b Handle list inputs correctly in AddEagerOpToGraph API.
PiperOrigin-RevId: 234166416
2019-02-15 10:27:18 -08:00
A. Unique TensorFlower
95f8fd4f30 Add support for attributes in TFE_AddEagerOpToGraph API.
PiperOrigin-RevId: 231629067
2019-01-30 11:44:03 -08:00
Mingsheng Hong
a6924e6aff Added tracing support to the eager C++ layer, where we can create a graph by
symbolically executing a sequence of eager ops. This involves the following
changes:

1. Extended the eager C++ layer with symbolic tensor support, where a
tensorflow::TensorHandle represents a graph node, whose execution yields the
"concrete" tensor value. In contrast, the existing tensor handles are conrete
tensors.

Symbolic tensors can be created from a graph node (represented as TF_Output) via
TFE_NewTensorHandleFromTFOutput(). The associated graph node can be retrieved
from a symbolic tensor via TFE_GetTFOutputFromTensorHandle().

2. Added another experimental C API TFE_AddEagerOpToGraph() for symbolic
execution of a TFE_Op, which converts the op to a graph node, and the graph is
associated with a newly added TFE_TraceContext object to be passed into the C
API call.

3. If an eager op OP takes any concrete tensors as input,
TFE_AddEagerOpToGraph() will create symbolic tensors for them, to serve as input
to the converted graph node from OP. When executing that graph, those concrete
tensors will be fed as input.

Here's an example tracing use case illustrated by Swift code:
let x = Tensor<Float>(1.0)
let y = x + x

The first statement is executed on the host, yielding a concrete tensor value
for x.

The second statement is first symbolically executed to create a
graph (containing the "Add" node). Next, the graph is executed to compute y.

During this symbolic execution, TFE_AddEagerOpToGraph() is called on the "Add"
eager op for x + x, to insert an "Add" graph node. The node takes as input a
symbolic tensor (a PlaceHolder graph node) corresponding to x. When executing
the graph, the concrete tensor of x is then fed as the input.

TFE_AddEagerOpToGraph() does not yet support TF op attributes.

An example call-site code of this feature is Swift for TensorFlow at
https://github.com/apple/swift/pull/21589 (where some of the above C APIs are
subject to name changes).

PiperOrigin-RevId: 230018312
2019-01-18 17:05:51 -08:00
Mingsheng Hong
a8e0f21a37 Added various debugging support to C++ eager layer: tensor handle and eager
operation. Added experimental C APIs for debug prints.

Added some VLOG statements for to help memory/pointer debugging.

PiperOrigin-RevId: 229998268
2019-01-18 15:01:15 -08:00
Akshay Modi
81493f17e8 Allow TFE_Execute to be invoked in a new thread.
Returns an TFE_ExecuteOpOnThreadResult which can be waited upon.

PiperOrigin-RevId: 222306168
2018-11-20 14:30:40 -08:00
Alexandre Passos
290dd72d2e Utility to check whether an op is stateful.
PiperOrigin-RevId: 221842425
2018-11-16 13:28:19 -08:00
A. Unique TensorFlower
5dbb021354 Added a C utility to create a ServerDef proto from text representation.
PiperOrigin-RevId: 214681193
2018-09-26 15:45:34 -07:00
Mingsheng Hong
f9cfb9e917 Extended experimental C API with MNIST dataset/iterators support.
PiperOrigin-RevId: 190500020
2018-03-26 11:53:04 -07:00
Mingsheng Hong
be917027e3 Added experimental C APIs to build a stack of dataset + iterator nodes that
reads imagenet TFRecord files.

PiperOrigin-RevId: 190488817
2018-03-26 10:53:46 -07:00
Mingsheng Hong
0191d264a6 Added experimental C APIs to build a hard-coded stack of dataset + iterator.
PiperOrigin-RevId: 190170332
2018-03-22 20:54:37 -07:00