(obj: any)
| 253 | */ |
| 254 | // tslint:disable-next-line:no-any |
| 255 | export function isIterable(obj: any): boolean { |
| 256 | let isTextDecoder = false; |
| 257 | if (tf.env().get('IS_BROWSER')) { |
| 258 | isTextDecoder = obj instanceof TextDecoder; |
| 259 | } else { |
| 260 | // tslint:disable-next-line:no-require-imports |
| 261 | const {StringDecoder} = require('string_decoder'); |
| 262 | isTextDecoder = obj instanceof StringDecoder; |
| 263 | } |
| 264 | return obj != null && (!ArrayBuffer.isView(obj)) && |
| 265 | (Array.isArray(obj) || |
| 266 | (typeof obj === 'object' && !(obj instanceof tf.Tensor) && |
| 267 | !(obj instanceof Promise) && !isTextDecoder)); |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Determine whether the argument can be converted to Tensor. |
no test coverage detected
searching dependent graphs…