Skip to content

Add tf.util.fetch() #1439

Closed
tensorflow/tfjs-core
#1663
@dsmilkov

Description

@dsmilkov

Add tf.util.fetch() as a cross-platform utility which mimics browser's fetch.

The weights loader should use this util instead of the global fetch (see weights_loader.ts) if the user hasn't provided a custom fetchFunc.

tf.util.fetch() should first check for the existence of a global fetch using tf.ENV.global.fetch. Then fallback for platform-specific solutions. The current platform-specific solution should be to use node-fetch when the environment is node.

Platforms such as wechat can override their global fetch fetch = customFetch, which will then be used by all fetching inside the TF.js eco-system (model loading, weights loading, etc)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions