MCPcopy Index your code
hub / github.com/tensorflow/tfjs / isIterable

Function isIterable

tfjs-data/src/util/deep_map.ts:255–268  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

253 */
254// tslint:disable-next-line:no-any
255export 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.

Callers 6

zipFunction · 0.90
cloneIfTensorFunction · 0.90
transformFunction · 0.90
deepMapInternalFunction · 0.70
deepZipInternalFunction · 0.70
zipToListFunction · 0.70

Calls 1

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…