Returns the converted value corresponding to y. Args: y: A ops.Tensor or a ops.Operation object. If latter, y should not have any outputs. Returns: If y does not need to be converted, it returns y as is. Else it returns the "converted value" corresponding to y.
(self, y)
| 1213 | return _stack(output, self._loop_len_vector).t |
| 1214 | |
| 1215 | def convert(self, y): |
| 1216 | """Returns the converted value corresponding to y. |
| 1217 | |
| 1218 | Args: |
| 1219 | y: A ops.Tensor or a ops.Operation object. If latter, y should not have |
| 1220 | any outputs. |
| 1221 | |
| 1222 | Returns: |
| 1223 | If y does not need to be converted, it returns y as is. Else it returns |
| 1224 | the "converted value" corresponding to y. |
| 1225 | """ |
| 1226 | if y is None: |
| 1227 | return None |
| 1228 | if isinstance(y, sparse_tensor.SparseTensor): |
| 1229 | return self._convert_sparse(y) |
| 1230 | assert isinstance(y, (ops.Tensor, ops.Operation)), y |
| 1231 | output = self._convert_helper(y) |
| 1232 | if isinstance(output, WrappedTensor): |
| 1233 | assert isinstance(y, ops.Tensor) |
| 1234 | return self._unwrap_or_tile(output) |
| 1235 | else: |
| 1236 | assert isinstance(y, ops.Operation) |
| 1237 | assert not y.outputs |
| 1238 | assert isinstance(output, ops.Operation) |
| 1239 | return output |
| 1240 | |
| 1241 | def _was_converted(self, t): |
| 1242 | """True if t is not a conversion of itself.""" |