DifferentiableNeuralComputer<T>
Models & Types · AiDotNet.NeuralNetworks
Represents a Differentiable Neural Computer (DNC), a neural network architecture that combines neural networks with external memory resources.
Inheritance: NeuralNetworkBase<T> → DeclaredModelLayoutBase<T> → SequenceModelLayoutBase<T> → DifferentiableNeuralComputer<T>
Implements: IAuxiliaryLossLayer<T>
For Beginners
A Differentiable Neural Computer is like a neural network with a notepad.
Imagine a traditional neural network as a person who can make decisions based on what they see, but can only keep information in their head. A DNC is like giving that person a notepad to:
- Write down important information
- Organize notes in a systematic way
- Look back at previously written notes when making decisions
- Learn which information is worth writing down and when to refer back to it
This combination of neural processing with external memory allows the DNC to solve problems that require remembering and reasoning about complex relationships or sequences of information, like navigating a subway map or following a multi-step recipe.
How It Works
A Differentiable Neural Computer (DNC) is an advanced neural network architecture that augments neural networks with an external memory matrix and mechanisms to read from and write to this memory. DNCs can learn to use their memory to store and retrieve information, enabling them to solve complex, structured problems that require reasoning and algorithm-like behavior. The key components include a controller neural network, a memory matrix, and read/write heads that interact with the memory through differentiable attention mechanisms.
Example
var input = Tensor<float>.CreateRandom(new[] { 1, 10, 64 });
var trainX = Tensor<float>.CreateRandom(4, 8);
var trainY = Tensor<float>.CreateRandom(4, 2);
var result = new AiModelBuilder<float, Tensor<float>, Tensor<float>>()
.ConfigureModel(new DifferentiableNeuralComputer<float>())
.Build(trainX, trainY);
var output = result.Predict(input);
Constructors
| Constructor | Summary |
|---|---|
DifferentiableNeuralComputer() |
Initializes a new instance of the DifferentiableNeuralComputer class with the specified parameters. |
DifferentiableNeuralComputer(NeuralNetworkArchitecture<T> architecture, int memorySize, int memoryWordSize, int controllerSize, int readHeads, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, IActivationFunction<T> activationFunction, DifferentiableNeuralComputerOptions options) |
Initializes a new instance of the DifferentiableNeuralComputer class with the specified parameters. |
DifferentiableNeuralComputer(NeuralNetworkArchitecture<T> architecture, int memorySize, int memoryWordSize, int controllerSize, int readHeads, IGradientBasedOptimizer<T, Tensor<T>, Tensor<T>> optimizer, ILossFunction<T> lossFunction, IVectorActivationFunction<T> vectorActivationFunction, DifferentiableNeuralComputerOptions options) |
Initializes a new instance of the DifferentiableNeuralComputer class with the specified parameters. |
Properties
| Property | Summary |
|---|---|
T AuxiliaryLossWeight { get; set; } |
Gets or sets the weight for the memory addressing auxiliary loss. |
bool SupportsTraining { get; } |
|
bool UseAuxiliaryLoss { get; set; } |
Gets or sets whether auxiliary loss (memory addressing regularization) should be used during training. |
Methods
| Method | Summary |
|---|---|
Dictionary<string, string> GetAuxiliaryLossDiagnostics() |
Gets diagnostic information about the memory addressing auxiliary loss. |
Dictionary<string, string> GetDiagnostics() |
Gets diagnostic information about this component’s state and behavior. |
List<Tensor<T>> ProcessSequence(List<Tensor<T>> inputs, bool resetMemory) |
Processes a sequence of inputs through the DNC. |
ModelMetadata<T> GetModelMetadata() |
Gets metadata about the Differentiable Neural Computer model. |
T ComputeAuxiliaryLoss() |
Computes the auxiliary loss for memory addressing regularization. |
Tensor<T> ForwardForTraining(Tensor<T> input) |
|
void ResetMemoryState() |
Resets the state of the Differentiable Neural Computer. |