Store
public struct Store
A key-value based parameter store.
-
Read a type-erased tensor from the store.
Declaration
Swift
public func read(_ key: String) -> NNC.AnyTensor?
Parameters
key
The key corresponding to that particular tensor.
-
Read a tensor from the store into tensor variable from dynamic graph.
Declaration
Swift
@discardableResult public func read(_ key: String, variable: DynamicGraph_Any) -> Bool
Parameters
key
The key corresponding to that particular tensor.
variable
The tensor variable to be initialized with.
-
Read parameters into a given model.
Declaration
Swift
public func read(_ key: String, model: Model)
Parameters
key
The key corresponding to a particular model.
model
The model to be initialized with parameters from a given key.
-
Read parameters into a given model builder.
Declaration
Swift
public func read(_ key: String, model: AnyModelBuilder)
Parameters
key
The key corresponding to a particular model.
model
The model builder to be initialized with parameters from a given key.
-
Write a tensor to the store.
Declaration
Swift
public func write(_ key: String, tensor: NNC.AnyTensor)
Parameters
key
The key corresponding to a particular tensor.
tensor
The tensor to be persisted.
-
Write a tensor variable to the store.
Declaration
Swift
public func write(_ key: String, variable: DynamicGraph_Any)
Parameters
key
The key corresponding to a particular tensor.
variable
The tensor variable to be persisted.
-
Write a model to the store.
Declaration
Swift
public func write(_ key: String, model: Model)
Parameters
key
The key corresponding to a particular model.
model
The model where its parameters to be persisted.
-
Write a model builder to the store.
Declaration
Swift
public func write(_ key: String, model: AnyModelBuilder)
Parameters
key
The key corresponding to a particular model builder.