| Commit message (Collapse) | Author | Age |
|
|
|
| |
PiperOrigin-RevId: 216412380
|
|
|
|
| |
PiperOrigin-RevId: 216270497
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
Prior to this change, tf.colocate_with(v) would insert spurious operations (a ReadVariableOp and an Identity) in the graph when v is a resource variable, and then
colocate the operations within the block with those newly added, otherwise disconnected, operations.
This commit avoids adding the unnecessary ReadVariableOp/Identity nodes and colocates
operations within the block with the VarHandleOp.
PiperOrigin-RevId: 216201638
|
|
|
|
| |
PiperOrigin-RevId: 215944829
|
|
|
|
| |
PiperOrigin-RevId: 215930596
|
|
|
|
|
|
| |
Add a warning to not disable optimizers without consulting with the Grappler team.
PiperOrigin-RevId: 215584369
|
|\
| |
| |
| | |
PiperOrigin-RevId: 215480021
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- 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
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
https://github.com/tensorflow/community/pull/16.
In addition to the changes in the doc, I made the following updates (these changes make sense to me and I didn't notice them when compiling the doc):
* deprecate saved_model.builder.SavedModelBuilder - replaced with saved_model.SavedModelBuilder
* deprecate python_io.tf_record_iterator - replaced with io.tf_record_iterator
* deprecate python_io.TFRecordWriter - replaced with io.TFRecordWriter
* move reduce_join to tf.string
PiperOrigin-RevId: 215253944
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a single test flag for enabling v2 control flow in tests since we do not plan to support v2 ops with legacy control flow.
We have 2 test decorators now:
@with_control_flow_v2: Enables all tests in a class to run with v2 control flow.
@disable_control_flow_v2: Disables a test function from running in v2. I have removed the skiptests to avoid setup/teardown overheads.
Enable tests in control_flow_ops_py_test that run with control_flow_v2.
PiperOrigin-RevId: 214980108
|
| |
| |
| |
| | |
repackage the return values into the getargspec struct.
|
| |
| |
| |
| | |
PiperOrigin-RevId: 214824023
|
| | |
|
|\ \
| |/
|/|
| | |
PiperOrigin-RevId: 214335741
|
|\ \
| | |
| | |
| | | |
PiperOrigin-RevId: 214271324
|
| | |
| | |
| | |
| | | |
PiperOrigin-RevId: 214251264
|
| | |
| | |
| | |
| | |
| | |
| | | |
GPU). This avoids many unnecessary CPU<->GPU memcpy and syncs.
PiperOrigin-RevId: 214108484
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
standard python `print` method, and deprecates the old `tf.Print` operator (to be removed in in v2.0).
It follows the design doc specified in https://github.com/tensorflow/community/pull/14 and additionally incorporates the community feedback and design review decisions.
This CL adds two new internal graph operators: a StringFormat operator that formats a template string with a list of input tensors to insert into the string and outputs a string scalar containing the result, and a PrintV2 operator that prints a string scalar to a specified output stream or logging level.
The formatting op is exposed at `tf.strings.Format`. A new python method is exposed at `tf.print` that takes a list of inputs that may be nested structures and may contain tensors, formats them nicely using the formatting op, and returns a PrintV2 operator that prints them. In Eager mode and inside defuns this PrintV2 operator will automatically be executed, but in graph mode it will need to be either added to `sess.run`, or used as a control dependency for other operators being executed.
As compared to the previous print function, the new print function:
- Has an API that more closely aligns with the standard python3 print
- Supports changing the print logging level/output stream
- allows printing arbitrary (optionally nested) data structures as opposed to just flat lists of tensors
- support printing sparse tensors
- changes printed tensor format to show more meaningful summary (recursively print the first and last elements of each tensor dimension, instead of just the first few elements of the tensor irregardless of dimension).
PiperOrigin-RevId: 213709924
|
| | |
| | |
| | |
| | | |
PiperOrigin-RevId: 213549838
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
/cpu is an old style and can be misleading for new people trying to specify other devices.
Also correct comparison in tensorflow/python/client/timeline_test.py
PiperOrigin-RevId: 212769480
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Note this is not part of the official public API, but we do allow
other modules to modify this value (e.g. in tests).
PiperOrigin-RevId: 212512883
|
|\ \ \
| | | |
| | | |
| | | | |
PiperOrigin-RevId: 212456799
|
| | | |\
| |_|_|/
|/| | | |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
error message had multiple newline characters.
PiperOrigin-RevId: 212381070
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | | |
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: 212348850
|
|\ \ \
| | | |
| | | |
| | | | |
PiperOrigin-RevId: 212314097
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
For 99% of all usecases, if the expected shape differs from the actual shape, people will typically rerun with an additional print statement to see what the actual output was.
PiperOrigin-RevId: 212303323
|
| | | |
| | | |
| | | |
| | | | |
PiperOrigin-RevId: 212211691
|
| |/ /
|/| |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
While running core_rnn_cell_test:
```
bazel test -s --verbose_failures --config=opt //tensorflow/contrib/rnn:core_rnn_cell_test
```
Noticed the following warning:
```
FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
```
This fix fixes the above warning.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This fixes dir() calls on instances of eager tensors so that it correctly
accesses the __dict__ of EagerTensorType.
Earlier it would fail due to an infinite "loop" in subtype_dict: https://github.com/python/cpython/blob/7e610bcdf128f61b925654e4fa80fbac83537d0e/Objects/typeobject.c#L2145
get_builtin_base_with_dict will return the same type (though I'm not sure this is reasonable behavior given its name).
The __dict__ getter for the type is subtype_dict creating an infinite tail recursion.
PiperOrigin-RevId: 212020695
|
| | |
| | |
| | |
| | |
| | |
| | | |
RELNOTES: n/a
PiperOrigin-RevId: 211804843
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This is so that gradients with respect to scalars pass (see the test added in
backprop_test.py).
A micro benchmark just calling constant_op.constant slows down a bit - this is
inevitable as we are creating a new python object.
After: walltime: ~2.1
Before: walltime: ~1.47
Linear regression benchmark is pretty much unchanged.
PiperOrigin-RevId: 211753801
|
| | |
| | |
| | |
| | | |
PiperOrigin-RevId: 211714574
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
use_gpu does not affect the creation of the session, it only affects the
context manager in which nodes are added to the graph, so it should not
be included in the consistency check.
PiperOrigin-RevId: 211659833
|
| | |
| | |
| | |
| | | |
PiperOrigin-RevId: 211592901
|
| | |
| | |
| | |
| | |
| | |
| | | |
to conform to `Experimental clang-format Check`
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
|
| | |
| | |
| | |
| | |
| | |
| | | |
value}}` and `^^key:value^^`. This change consolidate these two format.
PiperOrigin-RevId: 211550259
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
self -> _parameters -> self cycles were creating work for Python's garbage collector in training loops, where Distribution objects may be created repeatedly when executing eagerly. This CL just fixes that narrow memory issue; I'm not convinced dict(locals()) is super efficient, so we may want to follow up on that for performance.
Adds a few unit tests tests with run_test_in_graph_and_eager_modes(assert_no_eager_garbage=True). It'd be nice to expand this coverage over time.
Includes a small test_util simplification to support this (TFP tests don't like reset_default_graph for some reason). Testing for cycles in the TFP repo will need to wait on the Normal changes from the TF repo syncing.
PiperOrigin-RevId: 211520394
|
| | |
| | |
| | |
| | | |
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
|
| | |
| | |
| | |
| | | |
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This fix tries to address the issue raised in 21164 where
the single_image_random_dot_stereograms in different locale
(like de_DE) caused syntax error in python like:
```
File "<string>", line 28
def single_image_random_dot_stereograms(depth_values, hidden_surface_removal=True, convergence_dots_size=8, dots_per_inch=72, eye_separation=2,5, mu=0,333299994, normalize=True, normalize_max=-100, normalize_min=100, border_level=0, number_colors=256, output_image_shape=[1024, 768, 1], output_data_window=[1022, 757], name=None):
^
SyntaxError: invalid syntax
```
The issue was that the float to string conversion in
python_op_gen_internal.cc triggered snprintf (in `FloatToBuffer`) which is local
dependent and generates something like `eye_separatiion=2,5` in DE locale.
This fix replaced the float to string conversion with locale-independent
```
std::ostringstream s;
s.imbue(std::locale::classic());
```
This fix fixes 21164.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
|
|/ |
|
|
|
|
|
|
| |
is first of a series of CL to merge these into one. In this change, we remove the format tag from the errors.
PiperOrigin-RevId: 211146036
|
|\
| |
| |
| | |
PiperOrigin-RevId: 211145467
|