Skip to content

Latest commit

 

History

History
114 lines (90 loc) · 3 KB

File metadata and controls

114 lines (90 loc) · 3 KB

Dense Layer (denseLayer)

Category: AI Model

Intended behavior

Fully-connected neuron layer: every incoming value feeds every neuron through its own weight — the classic AI weight web, drawn live inside the node. Outputs the activated neuron values.

Inputs

ID Label Type Unwired default
in Values In any []
enabled Enabled boolean true

Outputs

ID Label Type Default
out Activations any undefined

Configuration defaults

{
  "neurons": 8,
  "activation": "sigmoid",
  "seed": 42
}

Observed frontend behavior

This calls the production passive computation with the declared input/config defaults. Cached state, trigger execution and project wiring are separate.

{
  "kind": "passive-default-probe",
  "outputs": {
    "out": [
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5
    ]
  }
}

Observed backend behavior

Offline production passive computation with the same declared defaults; no device or model service is invoked.

{
  "kind": "passive-default-probe",
  "outputs": {
    "out": [
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5,
      0.5
    ]
  }
}

Current frontend implementation

Extracted production branches; helper calls and project execution context are defined in the referenced modules.

src/lib/execution-helpers.ts:303

case "denseLayer": {
      const xs = toNumberVector(inputs.in);
      const neurons = Math.max(1, Math.min(64, Math.floor(Number(config.neurons ?? 8) || 1)));
      const seed = Math.floor(Number(config.seed ?? 42) || 0);
      const activation = config.activation ?? "sigmoid";
      const weights = generateWeights(seed, xs.length, neurons);
      // Normalize by sqrt(inputs) so activations stay in a useful range no
      // matter the grid size feeding the layer.
      const norm = Math.max(1, Math.sqrt(xs.length));
      outputs.out = weights.map((row) => {
        let z = 0;
        for (let i = 0; i < xs.length; i++) z += row[i] * xs[i];
        z = Math.max(-60, Math.min(60, z / norm));
        if (activation === "relu") return Math.max(0, z);
        if (activation === "tanh") return Math.tanh(z);
        return 1 / (1 + Math.exp(-z)); // sigmoid
      });
      break;
    }

Implementation references

Verification limits

  • Default passive probe is an observation, not proof of all configurations, trigger behavior, or correctness. See ../NODE_RUNTIME_AUDIT.md and ../AUDIT_VALIDATION.md for test evidence.
  • Enabled=false uses the runtime bypass mapping; bypass output can differ from the normal declared output type.

Source fingerprint: 7e9d192bd3a559a7c50253919867601ef02c311d61e859f7afb4cadcfa508430. Rebuild with npm run docs:index.