Commit Graph

31 Commits

Author SHA1 Message Date
A. Unique TensorFlower
966694417e Fix spelling error in map_fn documentation.
PiperOrigin-RevId: 344805330
Change-Id: Iace71268055552150a21a5fcee2f5421338f5959
2020-11-30 07:11:33 -08:00
Lukas Geiger
2ef80f2295 Use TensorShape.assert_is_compatible_with instead of merge_with 2020-10-09 11:28:09 +01:00
Edward Loper
ba73e805fe Preserve static information about outer dimension size in tf.map_fn with ragged/sparse outputs.
PiperOrigin-RevId: 333739750
Change-Id: Iedd8c18c0ba7b94f1487365e52f14a8926c92f90
2020-09-25 08:53:31 -07:00
Akshay Modi
cdac4cf5c5 Fix tf.map_fn interop with np ndarray
PiperOrigin-RevId: 323628461
Change-Id: Ib56efd25a2cd200cb1f2cb2469940f24b93cfcd2
2020-07-28 12:36:44 -07:00
TensorFlower Gardener
d80b6adbd2 Merge pull request from yongtang:39229-map_fn-empty-list
PiperOrigin-RevId: 318950663
Change-Id: Ia75f5bf028a94abbb7ebf2c7d3193309bdef9029
2020-06-29 21:05:52 -07:00
Mark Daoust
f44b07ed4e Fix formatting
Some of these indents are triggering markdown's (horrible) "4-space indent is a code block" feature

PiperOrigin-RevId: 316883013
Change-Id: If2b53a6788d3179b868a62fb6b4caeeb08caa4bf
2020-06-17 07:26:51 -07:00
Yong Tang
ad4323e934 Update tf.map_fn to specify that at least one tensor must be present
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

Typo fix

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-06-08 18:15:37 +00:00
Sung Jin Hwang
dae0485fed Pass static shapes for TensorArray used inside tf.map_fn().
If fn_output_signature argument contains TensorSpec then extract the static
shape information and pass them to TensorArray used to collect output slices.

This is required for TF Lite conversion of models using tf.map_fn(), because
the conversion rejects TensorArray/List with unknown element shapes.

PiperOrigin-RevId: 313810480
Change-Id: I1d1e381b7212b3e691d55ff43e84789a7b9ecd9a
2020-05-29 13:02:06 -07:00
bhack
64d839bb75 Fix lint and improve readibility 2020-05-15 18:21:51 +02:00
bhack
d6dd56f74f
Remove original fn call 2020-05-15 17:26:04 +02:00
bhack
560762e40d
Test autograph transform of fn 2020-05-15 16:49:53 +02:00
bhack
86342e236b restore a remove export 2020-05-15 02:45:52 +02:00
bhack
9a6a6476b5 Add test and remove decorator 2020-05-15 00:40:15 +00:00
bhack
ffef54602d Fix missing self
Add initial autograph wrapping in map_fn
2020-05-14 18:21:13 +02:00
Yong Tang
0ee6b3a69d Return ValueError in case of empty list input for tf.map_fn
This PR tries to address the issue raised in 39229 where
empty lists input was not checked and throw out a non-obvious error:
```python
>>> import numpy as np
>>> import tensorflow as tf
>>> fn = lambda x: x
>>> tf.map_fn(fn, [])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/3.7/site-packages/tensorflow/python/util/deprecation.py", line 574, in new_func
    return func(*args, **kwargs)
  File "/Library/Python/3.7/site-packages/tensorflow/python/ops/map_fn.py", line 425, in map_fn_v2
    name=name)
  File "/Library/Python/3.7/site-packages/tensorflow/python/ops/map_fn.py", line 213, in map_fn
    static_shape = elems_flat[0].shape
IndexError: list index out of range
>>>
```

In case of empty list the behavior is undefined as we even don't know the output dtype.

This PR update to perform a check and thrown out
`ValueError("elems must not be empty")` to help clarify.

This PR fixes 39229.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2020-05-07 15:25:41 +00:00
TensorFlower Gardener
81256beba4 Merge pull request from tomasvr:python-api-see-also
PiperOrigin-RevId: 305487515
Change-Id: If843aa3031c8c95f4ae8d20d70b526185e9cb905
2020-04-08 09:04:37 -07:00
Angus-Luo
bf967f19ab reformat examples 2020-03-31 12:21:23 +08:00
Angus-Luo
64117b7459 revise the format 2020-03-30 11:02:40 +08:00
Angus-Luo
9fc04fc531 fix pylint errors (Line too long) 2020-03-27 11:51:14 +08:00
Angus-Luo
652a4b64be tf.SparseTensor to tf.sparse.SparseTensor 2020-03-25 10:49:19 +08:00
tomas
ace0c9c722 added periods 2020-03-15 20:55:31 +01:00
tomas
c56d857f52 Added see-also for 'tf.scan' and 'tf.map_fn' 2020-03-15 19:34:41 +01:00
Edward Loper
0bbfe8d95d Update tf.map_fn to support RaggedTensors and SparseTensors.
PiperOrigin-RevId: 300134914
Change-Id: I84e75ea1d71257d34d045b82b54de208ea2fe75b
2020-03-10 11:32:14 -07:00
A. Unique TensorFlower
b844c87c89 Update tf.map_fn to support RaggedTensors and SparseTensors.
PiperOrigin-RevId: 299946627
Change-Id: I3de02f9a6c8b27abc0bdc1be48aa63f66fca36b1
2020-03-09 15:17:31 -07:00
Edward Loper
b784c7b1f0 Update tf.map_fn to support RaggedTensors and SparseTensors.
PiperOrigin-RevId: 299923143
Change-Id: Ieddcbc4811fb49b6206385352cf8f7344fbd4117
2020-03-09 13:53:03 -07:00
Saurabh Saxena
100fd45fd8 Support back_prop=False in while_v2.
Mark back_prop flag as deprecated in tf.while_loop, tf.map_fn, tf.foldl, tf.foldr, tf.scan.

PiperOrigin-RevId: 285433878
Change-Id: I59e5ea3b566b8fa1feae0884da704454562cef43
2019-12-13 16:23:25 -08:00
TensorFlower Gardener
e0678d62e1 Merge pull request from Squadrick:patch-2
PiperOrigin-RevId: 280710705
Change-Id: Ide2d80b8a780c922ebceee9ca68fe54bb88b2320
2019-11-15 12:33:14 -08:00
Dheeraj R Reddy
4ec6529517
Lint 2019-11-13 12:18:43 +05:30
Dheeraj R Reddy
dcc8bef426
Lint 2019-11-13 12:17:15 +05:30
Dheeraj R Reddy
ac5a48e238
Update docs of map_fn
Replace tf.contrib.eager.defun with tf.function
2019-11-12 23:30:26 +05:30
Gaurav Jain
79d86aca64 Move map_fn to separate file
PiperOrigin-RevId: 231529445
2019-01-29 21:24:59 -08:00