| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 201766085
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 201586130
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
the grpc_tensorflow_server.
PiperOrigin-RevId: 201198350
|
|
|
|
| |
PiperOrigin-RevId: 201110240
|
|
|
|
| |
PiperOrigin-RevId: 201033171
|
|
|
|
| |
PiperOrigin-RevId: 201011811
|
|
|
|
|
|
| |
This is required to do anything useful from python.
PiperOrigin-RevId: 200129777
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(_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
|
|
|
|
|
|
| |
intermediate tensor.
PiperOrigin-RevId: 197481473
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 196910675
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
(with bugfix)
PiperOrigin-RevId: 196184587
|
|
|
|
| |
PiperOrigin-RevId: 196127751
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 194997009
|
|
|
|
| |
PiperOrigin-RevId: 194796304
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 194031845
|
|
|
|
| |
PiperOrigin-RevId: 193728072
|
|
|
|
| |
PiperOrigin-RevId: 193698320
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
they are no longer needed. Also remove a duplicate function declaration.
PiperOrigin-RevId: 191918408
|
|
|
|
|
|
|
|
| |
tensorflow::str_util equivalents.
This will allow the deprecated methods to be removed.
PiperOrigin-RevId: 191350894
|
|
|
|
|
|
|
| |
Motivated by
https://stackoverflow.com/questions/49616532/a-tensorflow-eager-gpu-error/49617069
PiperOrigin-RevId: 191334050
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 190878279
|
|
|
|
| |
PiperOrigin-RevId: 190775681
|
|
|
|
| |
PiperOrigin-RevId: 190681610
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
The Python extensions aren't part of the official C API.
PiperOrigin-RevId: 190649576
|
|
|
|
|
|
| |
/ iterator stack.
PiperOrigin-RevId: 190536945
|
|
|
|
| |
PiperOrigin-RevId: 190500020
|
|
|
|
|
|
| |
reads imagenet TFRecord files.
PiperOrigin-RevId: 190488817
|
|
|
|
| |
PiperOrigin-RevId: 190479555
|
|
|
|
| |
PiperOrigin-RevId: 190308776
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
PiperOrigin-RevId: 190291768
|