Skip to main content
torch.js has not been released yet.
torch.js logotorch.js logotorch.js
PlaygroundContact
Login
Documentation
IntroductionType SafetyTensor ExpressionsTensor IndexingEinsumEinopsAutogradTraining a ModelProfiling & MemoryPyTorch MigrationBest PracticesRuntimesPerformancePyTorch CompatibilityBenchmarksDType Coverage
torch.js· 2026
LegalTerms of UsePrivacy Policy
/
/
  1. docs
  2. Spark
  3. spark
  4. worker
  5. clearPersisted

spark.worker.clearPersisted

function clearPersisted(key: string): void

Clear a persisted value.

Removes a specific persisted value from memory. The next call to persist with the same key will reinitialize the value.

Parameters

keystring
Identifier of the persisted value to clear

Examples

// Reset model to start fresh
spark.clearPersisted('model');

// Next persist('model', ...) will run initializer again
const model = spark.persist('model', () => nn.Sequential(...));

See Also

  • persist - Persist a value
  • clearAllPersisted - Clear all persisted state
Previous
clearPendingReload
Next
createController