PickGraphLayer<T>

Layers · AiDotNet.NeuralNetworks.Layers

PICK’s graph learning-convolutional network (reference GLCN): it learns a soft adjacency over the document’s text segments from their embeddings, then runs numLayersPickGcnLayer steps seeded by an embedding of the six box-relation features.

Inheritance: LayerBase<T> → PickGraphLayer<T>

Implements: IShapeContract

For Beginners

This decides which text boxes on a page should talk to each other, then lets them exchange information so that, for example, a “Total:” label informs the number beside it.

How It Works

Graph learning (reference GraphLearningLayer):

  • x_hat = x P, with no bias and learningDim columns.
  • A = softmax_j(LeakyReLU(w . |x_hat_i - x_hat_j|)) + 1e-10.
  • The graph-learning loss is

sum_ij exp(A_ij + eta ||x_hat_i - x_hat_j||) / N^2 + gamma ||A||_F.

The pairwise distance is computed as sqrt(s_ij + I_ij) - I_ij. That is the same value, and it keeps the gradient finite on the diagonal, where the reference’s norm of an exact zero vector has an infinite derivative.

Constructors

Constructor Summary
PickGraphLayer(int dim, int learningDim, int numLayers, double eta, double gamma) Creates the network.

Properties

Property Summary
bool SupportsTraining { get; }

Methods

Method Summary
Dictionary<string, string> GetParameterRoles() Returns parameter roles for per-role optimizer configuration (e.g., weight decay exemption for biases).
IReadOnlyList<ILayer<T>> GetSubLayers()
IReadOnlyList<OutputAxisContract> OutputAxesFor(int inputRank)
IReadOnlyList<Tensor<T>> GetTrainableParameters() Returns all trainable parameter tensors marked with [TrainableParameter].
void ResetState()
void SetTrainableParameters(IReadOnlyList<Tensor<T>> parameters) Replaces trainable parameter tensors (e.g., with ParameterBuffer views).
void ZeroGrad() Clears all gradient fields discovered by convention ({paramName}Gradient).

Fields

Field Summary
int RelationFeatures Box-relation features per node pair (reference: x_ij, y_ij, w_i/h_i, h_j/h_i, w_j/h_i, len_j/len_i).