license /**
 * IOHandlers that pass through the in-memory ModelArtifacts format.
 */ import { IOHandler , ModelArtifacts , SaveResult , TrainingConfig , WeightsManifestEntry } from './types' ; class PassthroughLoader implements IOHandler { constructor ( private readonly modelArtifacts ? ) { } async load ( ) { return this . modelArtifacts ; } } class PassthroughSaver implements IOHandler { constructor ( private readonly saveHandler ) { } async save ( modelArtifacts ) { return this . saveHandler ( modelArtifacts ) ; } } param modelArtifacts param weightSpecs param weightData param trainingConfig returns export function fromMemory ( modelArtifacts , weightSpecs ? , weightData ? , trainingConfig ? ) { if ( arguments . length === 1 ) { const isModelArtifacts = ( modelArtifacts as ModelArtifacts ) . modelTopology != null || ( modelArtifacts as ModelArtifacts ) . weightSpecs != null ; if ( isModelArtifacts ) { return new PassthroughLoader ( modelArtifacts as ModelArtifacts ) ; } else { console . warn ( 'Please call tf.io.fromMemory() with only one argument. ' + 'The argument should be of type ModelArtifacts. ' + 'The multi-argument signature of tf.io.fromMemory() has been ' + 'deprecated and will be removed in a future release.' ) ; return new PassthroughLoader ( { modelTopology : modelArtifacts as { } } ) ; } } else { console . warn ( 'Please call tf.io.fromMemory() with only one argument. ' + 'The argument should be of type ModelArtifacts. ' + 'The multi-argument signature of tf.io.fromMemory() has been ' + 'deprecated and will be removed in a future release.' ) ; return new PassthroughLoader ( { modelTopology : modelArtifacts as { } , weightSpecs , weightData , trainingConfig } ) ; } } param saveHandler export function withSaveHandler ( saveHandler ) { return new PassthroughSaver ( saveHandler ) ; }