aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c
Commit message (Collapse)AuthorAge
...
* [C API]: Bugfix for TF_AddGradients.Gravatar Asim Shankar2018-06-26
| | | | | | | | | | | | | | | | | | | | TF_AddGradients could create nodes in the graph with names that conflicted with other nodes in the graph. This would most clearly happen if TF_AddGradients() was called twice on the same graph, and could also happen if there were other nodes in the graph that happened to have "gradients" as a prefix of their name. Fix that. The added test in c_api_test.cc would fail in the call to TF_SessionRun() with Node 'gradients/OnesLike' is not unique without the changes to c_api.cc and c_api_internal.h While at it, also fixed a possible name collision bug when using the C++ API to constructor graphs (using Scope). Thanks @karllessard for pointing this out. PiperOrigin-RevId: 202087996
* Move cycle detection helper function from c/c_api to core/graph/validate.Gravatar A. Unique TensorFlower2018-06-22
| | | | PiperOrigin-RevId: 201766085
* Make ImportGraphDefOptions and ImportGraphDefResults own all strings.Gravatar Skye Wanderman-Milne2018-06-21
| | | | | | | | | | | This change introduces SafeTensorId, an alternative to TensorId that uses strings instead of StringPieces. It makes ImportGraphDefOptions/Results use SafeTensorIds instead of TensorIds so the caller isn't responsible for managing the string lifetime. import_graph_def in Python was broken before this change, although it wasn't caught in tests. PiperOrigin-RevId: 201622030
* Allow dynamic specification of clusters for eager remote execution.Gravatar Akshay Modi2018-06-21
| | | | PiperOrigin-RevId: 201586130
* [eager]: Support string attributes where the value contains `\0`.Gravatar Asim Shankar2018-06-20
| | | | | | | | | | Apparently, some custom operations stuff non-printable characters in string valued attributes. This change also makes the eager C API consistent with the C API for graph construction (TF_SetAttrString and TF_SetAttrStringList). PiperOrigin-RevId: 201372089
* 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
* Merge changes from github.Gravatar Akshay Modi2018-06-18
| | | | PiperOrigin-RevId: 201110240
* Automated g4 rollback of changelist 201011811Gravatar Akshay Modi2018-06-18
| | | | PiperOrigin-RevId: 201033171
* Merge changes from github.Gravatar Akshay Modi2018-06-18
| | | | PiperOrigin-RevId: 201011811
* Allow silent copies during remote execution.Gravatar Akshay Modi2018-06-11
| | | | | | This is required to do anything useful from python. PiperOrigin-RevId: 200129777
* C API: Fail gracefully if the serialized graph would be too large.Gravatar Asim Shankar2018-06-07
| | | | | | | | | | | See #19657 for some motivation. Without this explicit check, a large graph would trigger an assertion failure in the protobuf codebase (https://github.com/google/protobuf/blob/0456e269ee6505766474aa8d7b8bba7ac047f457/src/google/protobuf/message_lite.cc#L68) Pull Request for google/protobuf: https://github.com/google/protobuf/pull/4739 PiperOrigin-RevId: 199719082
* Add EagerTensor profiler and device shape utilitiesGravatar Igor Ganichev2018-05-25
| | | | | | | | | | | | | | | | | | | | | | | | | | This change includes the following steps to make EagerTensor profiler work: - Add a PaddedShapeFn to XlaDevice::Metadata. We need a backend-independent way to get a fully-padded shape and its layout on the device. This function is set during device construction. CPU and GPU devices effectively get an identity function since they neither change the layout nor pad. TPU gets the appropriate function. - Add TFE_TensorDebugInfo struct and C API methods for it. These methods are necessary to fetch the shape and layout from under the C API to the Python level. This can be a home for more debug information later. - Make EagerTensor weak referencable. This involves adding a pointer to the list of current weak references. This addition should have negligible overhead when profiler is not used. The only operations on this field are setting it to null on construction and checking if it is null on destruction. - Adding C++ functions callable from Python to register an instance of EagerTensorProfiler and retrieve debug information for a given EagerTensor. These functions are used in the new "inspect" module. - Finally, writing the actual profiler. PiperOrigin-RevId: 198098380
* Remove _get_backward_fn and depend on _gradient_function directly.Gravatar Akshay Modi2018-05-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (_magic_gradient_function was renamed to _gradient_function) Before: entry { name: "MicroBenchmarks.benchmark_tf_gradient_forward_identity" iters: 30000 wall_time: 5.88456789653 extras { key: "examples_per_sec" value { double_value: 169936.011885 } } } After: entry { name: "MicroBenchmarks.benchmark_tf_gradient_forward_identity" iters: 30000 wall_time: 5.04853725433 extras { key: "examples_per_sec" value { double_value: 198077.175551 } } } PiperOrigin-RevId: 197972668
* Fixes issue with gradient tape when asking for the gradient of an ↵Gravatar Alexandre Passos2018-05-21
| | | | | | intermediate tensor. PiperOrigin-RevId: 197481473
* Move runtime.{h,cc,_test.cc} into core/common_runtime/eager as attr_builderGravatar Akshay Modi2018-05-17
| | | | | | | | I'm not familiar with how the CMake build is set up but from the description of the problem the dependency graph is coarser than Bazel's, so I think this should fix #18925. PiperOrigin-RevId: 197061764
* Allow for remote eager execution.Gravatar Akshay Modi2018-05-16
| | | | PiperOrigin-RevId: 196910675
* Add missing #include. tensorflow::FunctionDef only happens to be available ↵Gravatar A. Unique TensorFlower2018-05-10
| | | | | | in this header because it happens to be forward-declared in one of the other .proto.h headers, but it's not actually used there and will go away. PiperOrigin-RevId: 196217574
* Do not differentiate integers in the eager backprop API.Gravatar Alexandre Passos2018-05-10
| | | | | | (with bugfix) PiperOrigin-RevId: 196184587
* Automated g4 rollback of changelist 195878952Gravatar Asim Shankar2018-05-10
| | | | PiperOrigin-RevId: 196127751
* Do not differentiage integers in the eager API.Gravatar Alexandre Passos2018-05-08
| | | | | | | | This is similar to the change made in: https://github.com/tensorflow/tensorflow/commit/f63750645826df65b05cad505546a86f0e347674 for backpropagation during graph construction via tf.gradients() PiperOrigin-RevId: 195878952
* Part 2 of Swift<->TF sends/recvs: support receiving tensors in TF fromGravatar Mingsheng Hong2018-05-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swift via direct session. The changes are: 1. Added a TF experimental C API for Swift host to enqueue a tensor for sending to TF. Again, the C APIs can be removed once the Fifo-queue based design proves stable later. 2. TFLowerGraph is extended to generate Fifo related nodes for TF to receive tensors. This is similar to the extension for TF to send tensors. 3. TFPartition is extended to support host send (createHostSend()), which does the tensor send via a new protocol method TensorSendableReceivable.sendToDevice(). The main complexity is in sending a scalar, where a new protocol method TensorSendableReceivable.createScalarTensor() is called to first create a tensor out of it, and then send it over to TF. Also removed code for protocol conformance on AccelerableByTensorFlow. Instead have compiler look up that conformance from the SILFunction on sending/receiving tensors. AccelerableByTensorFlow could be removed from the compiler-known protocol list now, but we'll defer that till things can stabilized more (in the past this protocol has been added to and removed from the list at different times). PiperOrigin-RevId: 195539436
* Replaced calls to tensorflow::StringPiece::ToString with std::string ↵Gravatar Peter Hawkins2018-05-02
| | | | | | | | | | conversions. That is, instances of sp.ToString() are replaced with std::string(sp). This will allow tensorflow::StringPiece::ToString to be removed, which is necessary before it can be replaced with absl::string_view. PiperOrigin-RevId: 195162126
* Merge changes from github.Gravatar Patrick Nguyen2018-05-01
| | | | PiperOrigin-RevId: 194997009
* Fixes to tape gradient for providing outputs and having multiple targets.Gravatar Alexandre Passos2018-04-30
| | | | PiperOrigin-RevId: 194796304
* This is Part 1 of Swift<->TF sends/recvs: support sending tensors from TF toGravatar Mingsheng Hong2018-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Swift via direct session. The changes are: 1. Added an experimental TF C API TF_DequeueNamedTensor() to consume the queued tensors from a dequeue op. One use case is for the Swift host program to consume tensors sent by TF, where the queue is a Fifo queue managed by TF. Enqueuing tensors are done by running an enqueue op in a graph. The queued tensors are not persisted, and will be lost if the process/machine dies. The queue has a bounded capacity, to prevent producer from being unboundedly ahead of consumer. while caller of TF_DequeueNamedTensor() could have run the Fifo dequeue op directly, the extra level of indirection provided by this API allows us to more easily switch the queuing impl to another mechanism. If and once we stabilize on the Fifo queue based impl, we can remove this API. 2. Added a new S4TF runtime API _TFCReceiveTensorHandle() that receives a tensor via TF_DequeueNamedTensor(). 3. To support tensor receives in host program, taught PartitionCloner in TFPartition to insert SIL code to call _TFCReceiveTensorHandle(). 4. To support tensor sends in accelerator program, taught TFGraphLowering in generate QueueEnqueueV2 nodes in the TF graphs, with appropriate control dependence to make sure these nodes get executed. a) The enqueue produces no output tensor, and is executed only for its side effect. To ensure it is executed properly, control dependence is wired up. The general design is: before a TF_Function (can be a top level function or the body function of a while op) produces an output tensor OT, make OT control dependent on the enqueue op, so that enqueue gets run before the function returns. b) If tensor send occurs in a while loop body, the body logic currently gets lowered in 3 places: the while op cond function, the while op body function, and the ops at the same level as the while op itself (for running the last loop iteration). In this case, the correct TFGraph lowering is to run the enqueue in the last 2 out of the 3 places above. After this CL, the dual versions of the above (dequeuing via an op, and enqueuing via C API) will be added. PiperOrigin-RevId: 194658511
* Make TF functions work with _USE_C_SHAPES=True.Gravatar Skye Wanderman-Milne2018-04-24
| | | | | | | | | | It turns out regular functions need to manually copy handle data in addition to eager GraphModeFunctions, so I moved the C extensions to python_api.h from eager/c_api.h. This also cleans up function_test.py to assume the C API is enabled. PiperOrigin-RevId: 194158700
* Merge changes from github.Gravatar Yifei Feng2018-04-23
| | | | PiperOrigin-RevId: 194031845
* Move the guts of TFE_Execute into EagerExecuteGravatar Akshay Modi2018-04-20
| | | | PiperOrigin-RevId: 193728072
* Move the guts of TFE_Op into EagerOperationGravatar Akshay Modi2018-04-20
| | | | PiperOrigin-RevId: 193698320
* Merged commit includes the following changes:Gravatar A. Unique TensorFlower2018-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 193422827 by yifeif: Fix buildifier error. -- 193421691 by skyewm: Make GraphModeFunctions work with _USE_C_SHAPES=True. Tensor._handle_data is going away. This change adds special hooks for propagating the resource handle shape information through EagerTensors. -- 193421473 by A. Unique TensorFlower: Register dynamic_stitch for DT_VARIANT type. -- 193421175 by nolivia: disabling flaky tsan test -- 193420117 by nolivia: disabling flaky test in tensorflow that has no apparent culprit -- PiperOrigin-RevId: 193422827
* Avoid ToString() in Eager's TFE_Execute.Gravatar Akshay Modi2018-04-17
| | | | | | | | | | | | | | | | | | | | | Also use InlinedVector instead of std::vector for non-async path Before: Benchmark Time(ns) CPU(ns) Iterations ------------------------------------------------------------- BM_Execute/0 1895 1898 360200 Execute BM_Execute/1 1193 1942 358322 ExecuteAsync BM_ExecuteFunction/0 5812 5825 100000 ExecuteFunction BM_ExecuteFunction/1 5015 5374 100000 ExecuteFunctionAsync After: Benchmark Time(ns) CPU(ns) Iterations ------------------------------------------------------------- BM_Execute/0 1604 1607 428262 Execute BM_Execute/1 1150 1765 404821 ExecuteAsync BM_ExecuteFunction/0 5615 5626 100000 ExecuteFunction BM_ExecuteFunction/1 5111 5476 100000 ExecuteFunctionAsync PiperOrigin-RevId: 193218331
* experimental C API: Fix compilation failure in Windows.Gravatar Asim Shankar2018-04-10
| | | | | | | | | | | | | The functions added in https://github.com/tensorflow/tensorflow/commit/be917027e37c5e8f21f6ba07f24bdbf072cf6dfd are temporary, and their existence breaks compilation in MSVC because of https://docs.microsoft.com/en-us/cpp/c-language/maximum-string-length and https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2026 So just disabling it in Windows for now. PiperOrigin-RevId: 192391164
* Remove `TF_InitializeTPU` and `TF_ShutdownTPU` from experimental C API as ↵Gravatar Richard Wei2018-04-06
| | | | | | they are no longer needed. Also remove a duplicate function declaration. PiperOrigin-RevId: 191918408
* Replaced calls to deprecated tensorflow::StringPiece methods with theirGravatar A. Unique TensorFlower2018-04-02
| | | | | | | | tensorflow::str_util equivalents. This will allow the deprecated methods to be removed. PiperOrigin-RevId: 191350894
* eager: Tweak error message.Gravatar Asim Shankar2018-04-02
| | | | | | | Motivated by https://stackoverflow.com/questions/49616532/a-tensorflow-eager-gpu-error/49617069 PiperOrigin-RevId: 191334050
* 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
* Turns eager device placement on by default.Gravatar Alexandre Passos2018-03-29
| | | | | | | | | | | | Change the device policy to have silent copies, which are logged when RunMetadata tracking is enabled. In the process, changed TensorHandle to always keep its context around if it gets one. Changed TFE_TensorHandleResolve to, if necessary, copy to the CPU (since the user has no control as to whether this copy is needed by default). PiperOrigin-RevId: 190978086
* Support structured source in GradientTape.gradientGravatar Igor Ganichev2018-03-28
| | | | | | | | | | | | | | | | | Before this change, it was easy to forget [] around the source tensor. This mistake lead to GradientTape.gradient(), returning a list of Nones. Nones normally tell to the user that the source and the target are not connected via differentiable operations, which is not the source of the error in this case. Instead of adding a check that `sources` is a list of tensors, this CL adds ability to handle structured source (which includes a lone tensor), similarly to many existing TensorFlow APIs. Also, with Alex's help, it fixes a bug where repeated tensors in `sources` were not handled correctly. PiperOrigin-RevId: 190878583
* Remove all_opensource_files. It's not needed any more.Gravatar Martin Wicke2018-03-28
| | | | PiperOrigin-RevId: 190878279
* Move ExecuteNode and CopyToDevice_InternalGravatar Alexandre Passos2018-03-28
| | | | PiperOrigin-RevId: 190775681
* Moves Execute() from c_api.ccGravatar Alexandre Passos2018-03-27
| | | | PiperOrigin-RevId: 190681610
* Make _USE_C_API = True and _USE_C_SHAPES = False work with handle data, take 2.Gravatar Skye Wanderman-Milne2018-03-27
| | | | | | | | This change makes _set_shapes_for_outputs_c_api fetch and set Tensor._handle_data. This is necessary for running the Python shape inference code on resource tensors. PiperOrigin-RevId: 190681459
* Exclude Python C extension from tensorflow/c:srcs target.Gravatar Skye Wanderman-Milne2018-03-27
| | | | | | The Python extensions aren't part of the official C API. PiperOrigin-RevId: 190649576
* In the experimental C API, parametrized batch_size for the generate dataset ↵Gravatar Mingsheng Hong2018-03-26
| | | | | | / iterator stack. PiperOrigin-RevId: 190536945
* Extended experimental C API with MNIST dataset/iterators support.Gravatar Mingsheng Hong2018-03-26
| | | | PiperOrigin-RevId: 190500020
* Added experimental C APIs to build a stack of dataset + iterator nodes thatGravatar Mingsheng Hong2018-03-26
| | | | | | reads imagenet TFRecord files. PiperOrigin-RevId: 190488817
* Automated g4 rollback of changelist 190293303Gravatar A. Unique TensorFlower2018-03-26
| | | | PiperOrigin-RevId: 190479555
* Fix loop variable type and status propagationGravatar A. Unique TensorFlower2018-03-25
| | | | PiperOrigin-RevId: 190308776
* Make _USE_C_API = True and _USE_C_SHAPES = False work with handle data.Gravatar Skye Wanderman-Milne2018-03-25
| | | | | | | | This change makes _set_shapes_for_outputs_c_api fetch and set Tensor._handle_data. This is necessary for running the Python shape inference code on resource tensors. PiperOrigin-RevId: 190293303
* Moves TensorHandleCopyToDevice to TensorHandle::CopyToDevice.Gravatar Alexandre Passos2018-03-25
| | | | PiperOrigin-RevId: 190291768