For each tensor's pair, swap the end of (t0,t1). B0 B1 B0 B1 | | => X A0 A1 A0 A1 Args: ts0: an object convertible to a list of `tf.Tensor`. ts1: an object convertible to a list of `tf.Tensor`. can_modify: iterable of operations which can be modified. A
(ts0, ts1, can_modify=None, cannot_modify=None)
| 206 | |
| 207 | |
| 208 | def swap_ts(ts0, ts1, can_modify=None, cannot_modify=None): |
| 209 | """For each tensor's pair, swap the end of (t0,t1). |
| 210 | |
| 211 | B0 B1 B0 B1 |
| 212 | | | => X |
| 213 | A0 A1 A0 A1 |
| 214 | |
| 215 | Args: |
| 216 | ts0: an object convertible to a list of `tf.Tensor`. |
| 217 | ts1: an object convertible to a list of `tf.Tensor`. |
| 218 | can_modify: iterable of operations which can be modified. Any operation |
| 219 | outside within_ops will be left untouched by this function. |
| 220 | cannot_modify: iterable of operations which cannot be modified. |
| 221 | Any operation within cannot_modify will be left untouched by this |
| 222 | function. |
| 223 | Returns: |
| 224 | The number of individual modifications made by the function. |
| 225 | Raises: |
| 226 | TypeError: if ts0 or ts1 cannot be converted to a list of tf.Tensor. |
| 227 | TypeError: if can_modify or cannot_modify is not None and cannot be |
| 228 | converted to a list of tf.Operation. |
| 229 | """ |
| 230 | return _reroute_ts(ts0, ts1, _RerouteMode.swap, can_modify, cannot_modify) |
| 231 | |
| 232 | |
| 233 | def reroute_ts(ts0, ts1, can_modify=None, cannot_modify=None): |
nothing calls this directly
no test coverage detected