Class RecurrentState
Object that represent memory (recurrent state) between the executions of a given model.
Namespace: Unity.Barracuda
Syntax
public class RecurrentState : IDisposable
Constructors
RecurrentState(Model, Int32, Dictionary<String, Tensor>)
Constructs recurrent state for a specific model
Declaration
public RecurrentState(Model model, int batchSize = null, Dictionary<string, Tensor> grabFromInputs = null)
Parameters
Type | Name | Description |
---|---|---|
Model | model | the associated model |
Int32 | batchSize | has to match the batch dimension of the input tensor(s). Specifying -1 will use batch size of the memory tensors as declared in the model |
Dictionary<String, Tensor> | grabFromInputs | optional dictionary of named tensors that can be used as a memory. If name of the tensor matches the memory, tensor will be removed from the dictionary and used as memory |
Methods
AfterExecution(IWorker)
Internal callback called after execution of the model finished. This callback stores results of the current iteration in the memory.
Declaration
public void AfterExecution(IWorker worker)
Parameters
Type | Name | Description |
---|---|---|
IWorker | worker | IWorker |
BeforeExecution(IWorker)
Internal callback called before the execution of the model. This callback prepares model for the next iteration according to the memory.
Declaration
public void BeforeExecution(IWorker worker)
Parameters
Type | Name | Description |
---|---|---|
IWorker | worker | IWorker |
Dispose()
Dispose RecurrentState
Declaration
public virtual void Dispose()
Finalize()
Finalize RecurrentState
Declaration
protected void Finalize()
GetBatchSize()
Returns batch dimension used for the memories.
Declaration
public int GetBatchSize()
Returns
Type | Description |
---|---|
Int32 | batch dimension used for the memories |