@almadar/std 3.2.3 → 3.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +72 -21
- package/README.md +1 -1
- package/behaviors/exports/atoms/std-combat-log.orb +12 -12
- package/behaviors/exports/atoms/std-dialogue-box.orb +11 -11
- package/behaviors/exports/atoms/std-game-audio.orb +9 -9
- package/behaviors/exports/atoms/std-game-canvas3d.orb +24 -24
- package/behaviors/exports/atoms/std-game-hud.orb +10 -10
- package/behaviors/exports/atoms/std-game-menu.orb +12 -12
- package/behaviors/exports/atoms/std-game-over-screen.orb +9 -9
- package/behaviors/exports/atoms/std-inventory-panel.orb +13 -13
- package/behaviors/exports/atoms/std-isometric-canvas.orb +9 -9
- package/behaviors/exports/atoms/std-platformer-canvas.orb +9 -9
- package/behaviors/exports/atoms/std-score-board.orb +9 -9
- package/behaviors/exports/atoms/std-selection.orb +32 -18
- package/behaviors/exports/atoms/std-service-custom-bearer.orb +557 -0
- package/behaviors/exports/atoms/std-service-custom-header.orb +559 -0
- package/behaviors/exports/atoms/std-service-custom-noauth.orb +553 -0
- package/behaviors/exports/atoms/std-service-custom-query.orb +559 -0
- package/behaviors/exports/atoms/std-service-email.orb +540 -0
- package/behaviors/exports/atoms/std-service-github.orb +586 -0
- package/behaviors/exports/atoms/std-service-llm.orb +671 -0
- package/behaviors/exports/atoms/std-service-oauth.orb +764 -0
- package/behaviors/exports/atoms/std-service-redis.orb +580 -0
- package/behaviors/exports/atoms/std-service-storage.orb +664 -0
- package/behaviors/exports/atoms/std-service-stripe.orb +639 -0
- package/behaviors/exports/atoms/std-service-twilio.orb +611 -0
- package/behaviors/exports/atoms/std-service-youtube.orb +696 -0
- package/behaviors/exports/atoms/std-simulation-canvas.orb +9 -9
- package/behaviors/exports/atoms/std-sprite.orb +17 -17
- package/behaviors/exports/atoms/std-validate-on-save.orb +623 -0
- package/behaviors/exports/molecules/std-quiz.orb +48 -24
- package/behaviors/exports/molecules/std-service-content-pipeline.orb +915 -0
- package/behaviors/exports/molecules/std-service-custom-api-tester.orb +860 -0
- package/behaviors/exports/molecules/std-service-devops-toolkit.orb +1526 -0
- package/behaviors/exports/molecules/std-service-notification-hub.orb +696 -0
- package/behaviors/exports/molecules/std-service-payment-flow.orb +873 -0
- package/behaviors/exports/organisms/std-service-marketplace.orb +5191 -0
- package/behaviors/exports/organisms/std-service-research-assistant.orb +3568 -0
- package/behaviors/exports/test-schemas/os-trigger-simulation.orb +202 -0
- package/behaviors/exports/validation-report.json +2 -2
- package/dist/behaviors/exports/atoms/std-combat-log.orb +12 -12
- package/dist/behaviors/exports/atoms/std-dialogue-box.orb +11 -11
- package/dist/behaviors/exports/atoms/std-game-audio.orb +9 -9
- package/dist/behaviors/exports/atoms/std-game-canvas3d.orb +24 -24
- package/dist/behaviors/exports/atoms/std-game-hud.orb +10 -10
- package/dist/behaviors/exports/atoms/std-game-menu.orb +12 -12
- package/dist/behaviors/exports/atoms/std-game-over-screen.orb +9 -9
- package/dist/behaviors/exports/atoms/std-inventory-panel.orb +13 -13
- package/dist/behaviors/exports/atoms/std-isometric-canvas.orb +9 -9
- package/dist/behaviors/exports/atoms/std-platformer-canvas.orb +9 -9
- package/dist/behaviors/exports/atoms/std-score-board.orb +9 -9
- package/dist/behaviors/exports/atoms/std-selection.orb +32 -18
- package/dist/behaviors/exports/atoms/std-service-custom-bearer.orb +557 -0
- package/dist/behaviors/exports/atoms/std-service-custom-header.orb +559 -0
- package/dist/behaviors/exports/atoms/std-service-custom-noauth.orb +553 -0
- package/dist/behaviors/exports/atoms/std-service-custom-query.orb +559 -0
- package/dist/behaviors/exports/atoms/std-service-email.orb +540 -0
- package/dist/behaviors/exports/atoms/std-service-github.orb +586 -0
- package/dist/behaviors/exports/atoms/std-service-llm.orb +671 -0
- package/dist/behaviors/exports/atoms/std-service-oauth.orb +764 -0
- package/dist/behaviors/exports/atoms/std-service-redis.orb +580 -0
- package/dist/behaviors/exports/atoms/std-service-storage.orb +664 -0
- package/dist/behaviors/exports/atoms/std-service-stripe.orb +639 -0
- package/dist/behaviors/exports/atoms/std-service-twilio.orb +611 -0
- package/dist/behaviors/exports/atoms/std-service-youtube.orb +696 -0
- package/dist/behaviors/exports/atoms/std-simulation-canvas.orb +9 -9
- package/dist/behaviors/exports/atoms/std-sprite.orb +17 -17
- package/dist/behaviors/exports/atoms/std-validate-on-save.orb +623 -0
- package/dist/behaviors/exports/molecules/std-quiz.orb +48 -24
- package/dist/behaviors/exports/molecules/std-service-content-pipeline.orb +915 -0
- package/dist/behaviors/exports/molecules/std-service-custom-api-tester.orb +860 -0
- package/dist/behaviors/exports/molecules/std-service-devops-toolkit.orb +1526 -0
- package/dist/behaviors/exports/molecules/std-service-notification-hub.orb +696 -0
- package/dist/behaviors/exports/molecules/std-service-payment-flow.orb +873 -0
- package/dist/behaviors/exports/organisms/std-service-marketplace.orb +5191 -0
- package/dist/behaviors/exports/organisms/std-service-research-assistant.orb +3568 -0
- package/dist/behaviors/exports/test-schemas/os-trigger-simulation.orb +202 -0
- package/dist/behaviors/exports/validation-report.json +2 -2
- package/dist/behaviors/functions/index.d.ts +662 -1
- package/dist/behaviors/functions/index.js +7638 -2117
- package/dist/behaviors/functions/index.js.map +1 -1
- package/dist/behaviors/index.d.ts +1 -1
- package/dist/behaviors/index.js +7638 -2117
- package/dist/behaviors/index.js.map +1 -1
- package/dist/exports/atoms/std-combat-log.orb +12 -12
- package/dist/exports/atoms/std-dialogue-box.orb +11 -11
- package/dist/exports/atoms/std-game-audio.orb +9 -9
- package/dist/exports/atoms/std-game-canvas3d.orb +24 -24
- package/dist/exports/atoms/std-game-hud.orb +10 -10
- package/dist/exports/atoms/std-game-menu.orb +12 -12
- package/dist/exports/atoms/std-game-over-screen.orb +9 -9
- package/dist/exports/atoms/std-inventory-panel.orb +13 -13
- package/dist/exports/atoms/std-isometric-canvas.orb +9 -9
- package/dist/exports/atoms/std-platformer-canvas.orb +9 -9
- package/dist/exports/atoms/std-score-board.orb +9 -9
- package/dist/exports/atoms/std-selection.orb +32 -18
- package/dist/exports/atoms/std-service-custom-bearer.orb +557 -0
- package/dist/exports/atoms/std-service-custom-header.orb +559 -0
- package/dist/exports/atoms/std-service-custom-noauth.orb +553 -0
- package/dist/exports/atoms/std-service-custom-query.orb +559 -0
- package/dist/exports/atoms/std-service-email.orb +540 -0
- package/dist/exports/atoms/std-service-github.orb +586 -0
- package/dist/exports/atoms/std-service-llm.orb +671 -0
- package/dist/exports/atoms/std-service-oauth.orb +764 -0
- package/dist/exports/atoms/std-service-redis.orb +580 -0
- package/dist/exports/atoms/std-service-storage.orb +664 -0
- package/dist/exports/atoms/std-service-stripe.orb +639 -0
- package/dist/exports/atoms/std-service-twilio.orb +611 -0
- package/dist/exports/atoms/std-service-youtube.orb +696 -0
- package/dist/exports/atoms/std-simulation-canvas.orb +9 -9
- package/dist/exports/atoms/std-sprite.orb +17 -17
- package/dist/exports/atoms/std-validate-on-save.orb +623 -0
- package/dist/exports/molecules/std-quiz.orb +48 -24
- package/dist/exports/molecules/std-service-content-pipeline.orb +915 -0
- package/dist/exports/molecules/std-service-custom-api-tester.orb +860 -0
- package/dist/exports/molecules/std-service-devops-toolkit.orb +1526 -0
- package/dist/exports/molecules/std-service-notification-hub.orb +696 -0
- package/dist/exports/molecules/std-service-payment-flow.orb +873 -0
- package/dist/exports/organisms/std-service-marketplace.orb +5191 -0
- package/dist/exports/organisms/std-service-research-assistant.orb +3568 -0
- package/dist/exports/test-schemas/os-trigger-simulation.orb +202 -0
- package/dist/exports/validation-report.json +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7887 -2216
- package/dist/index.js.map +1 -1
- package/dist/modules/array.d.ts +1 -1
- package/dist/modules/async.d.ts +1 -1
- package/dist/modules/contract.d.ts +22 -0
- package/dist/modules/contract.js +100 -0
- package/dist/modules/contract.js.map +1 -0
- package/dist/modules/data.d.ts +22 -0
- package/dist/modules/data.js +117 -0
- package/dist/modules/data.js.map +1 -0
- package/dist/modules/format.d.ts +1 -1
- package/dist/modules/graph.d.ts +23 -0
- package/dist/modules/graph.js +209 -0
- package/dist/modules/graph.js.map +1 -0
- package/dist/modules/index.d.ts +5 -1
- package/dist/modules/index.js +593 -63
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/math.d.ts +1 -1
- package/dist/modules/nn.d.ts +1 -1
- package/dist/modules/nn.js +14 -14
- package/dist/modules/nn.js.map +1 -1
- package/dist/modules/object.d.ts +1 -1
- package/dist/modules/os.d.ts +19 -0
- package/dist/modules/os.js +116 -0
- package/dist/modules/os.js.map +1 -0
- package/dist/modules/prob.d.ts +1 -1
- package/dist/modules/str.d.ts +1 -1
- package/dist/modules/tensor.d.ts +1 -1
- package/dist/modules/tensor.js +29 -29
- package/dist/modules/tensor.js.map +1 -1
- package/dist/modules/time.d.ts +1 -1
- package/dist/modules/train.d.ts +1 -1
- package/dist/modules/train.js +19 -19
- package/dist/modules/train.js.map +1 -1
- package/dist/modules/validate.d.ts +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +184 -65
- package/dist/registry.js.map +1 -1
- package/dist/{types-CmNM_IbV.d.ts → types-DOeGXRCm.d.ts} +3 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../modules/tensor.ts"],"names":[],"mappings":";AAgBO,IAAM,gBAAA,GAAoD;AAAA;AAAA;AAAA;AAAA,EAK/D,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,0BAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,aAAa,wDAAA;AAAyD,KACvG;AAAA,IACA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,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,YAAA;AAAa,KAC9D;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,iCAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,UAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,yBAAA;AAA0B,KAC3E;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,kBAAA,GAA+B;AAC7C,EAAA,OAAO,MAAA,CAAO,KAAK,gBAAgB,CAAA;AACrC","file":"tensor.js","sourcesContent":["/**\n * Tensor Module - Tensor Operations\n *\n * Provides operators for creating and manipulating tensors.\n * Tensors are multi-dimensional arrays used for neural network inputs/outputs.\n * Compiled to native tensor libraries (PyTorch, NumPy, etc.) by the Rust compiler.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Tensor module operators.\n * These operators create and manipulate tensors.\n */\nexport const TENSOR_OPERATORS: Record<string, StdOperatorMeta> = {\n // ============================================================================\n // Creation\n // ============================================================================\n\n 'tensor/from': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor from array',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'data', type: 'array', description: 'Array of numbers (can be nested for multi-dimensional)' },\n ],\n example: '[\"tensor/from\", [1.0, 2.0, 3.0]]',\n },\n 'tensor/zeros': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor filled with zeros',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/zeros\", [3, 4]] // 3x4 tensor of zeros',\n },\n 'tensor/ones': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor filled with ones',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/ones\", [3, 4]] // 3x4 tensor of ones',\n },\n 'tensor/rand': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor with random values in [0, 1)',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/rand\", [16]] // Random 16-element vector',\n },\n 'tensor/randn': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor with random values from standard normal distribution',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/randn\", [16]] // Random normal 16-element vector',\n },\n\n // ============================================================================\n // Shape & Indexing\n // ============================================================================\n\n 'tensor/shape': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Get tensor shape as array',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/shape\", \"@entity.sensors\"] // => [16]',\n },\n 'tensor/get': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get element at index',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'index', type: 'number | number[]', description: 'Index (single for 1D, array for multi-D)' },\n ],\n example: '[\"tensor/get\", \"@entity.output\", 3] // Get 4th element',\n },\n 'tensor/slice': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 3,\n maxArity: 3,\n description: 'Get slice of tensor',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'start', type: 'number', description: 'Start index' },\n { name: 'end', type: 'number', description: 'End index (exclusive)' },\n ],\n example: '[\"tensor/slice\", \"@entity.output\", 0, 3] // First 3 elements',\n },\n 'tensor/reshape': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Reshape tensor to new shape (total elements must match)',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'shape', type: 'number[]', description: 'New shape' },\n ],\n example: '[\"tensor/reshape\", \"@entity.data\", [4, 4]] // Reshape to 4x4',\n },\n 'tensor/flatten': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Flatten tensor to 1D',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/flatten\", \"@entity.data\"]',\n },\n\n // ============================================================================\n // Math Operations\n // ============================================================================\n\n 'tensor/add': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise addition',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/add\", \"@entity.a\", \"@entity.b\"]',\n },\n 'tensor/sub': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise subtraction',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/sub\", \"@entity.a\", \"@entity.b\"]',\n },\n 'tensor/mul': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise multiplication',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/mul\", \"@entity.weights\", 0.99] // Decay weights',\n },\n 'tensor/div': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise division',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/div\", \"@entity.gradient\", \"@entity.batchSize\"]',\n },\n 'tensor/matmul': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Matrix multiplication',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor (NxM)' },\n { name: 'b', type: 'tensor', description: 'Second tensor (MxK)' },\n ],\n example: '[\"tensor/matmul\", \"@entity.input\", \"@entity.weights\"]',\n },\n 'tensor/dot': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Dot product of two 1D tensors',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'a', type: 'tensor', description: 'First vector' },\n { name: 'b', type: 'tensor', description: 'Second vector' },\n ],\n example: '[\"tensor/dot\", \"@entity.a\", \"@entity.b\"]',\n },\n\n // ============================================================================\n // Reductions\n // ============================================================================\n\n 'tensor/sum': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Sum of tensor elements',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/sum\", \"@entity.rewards\"] // Total reward',\n },\n 'tensor/mean': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Mean of tensor elements',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/mean\", \"@entity.losses\"]',\n },\n 'tensor/max': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Maximum value in tensor',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/max\", \"@entity.qValues\"]',\n },\n 'tensor/min': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Minimum value in tensor',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/min\", \"@entity.distances\"]',\n },\n 'tensor/argmax': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Index of maximum value',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/argmax\", \"@entity.qValues\"] // Best action index',\n },\n 'tensor/norm': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'L2 norm of tensor',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'p', type: 'number', description: 'Norm order (default 2)', optional: true, defaultValue: 2 },\n ],\n example: '[\"tensor/norm\", \"@entity.gradient\"]',\n },\n\n // ============================================================================\n // Range Validation (for contracts)\n // ============================================================================\n\n 'tensor/allInRange': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Check if all elements are within range [min, max]',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'range', type: '[number, number]', description: 'Range as [min, max]' },\n ],\n example: '[\"tensor/allInRange\", \"@payload.input\", [-1.0, 1.0]]',\n },\n 'tensor/outOfRangeIndices': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get indices of elements outside range',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'range', type: '[number, number]', description: 'Range as [min, max]' },\n ],\n example: '[\"tensor/outOfRangeIndices\", \"@payload.input\", [-1.0, 1.0]]',\n },\n 'tensor/clamp': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 3,\n maxArity: 3,\n description: 'Clamp all elements to range [min, max]',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'min', type: 'number', description: 'Minimum value' },\n { name: 'max', type: 'number', description: 'Maximum value' },\n ],\n example: '[\"tensor/clamp\", \"@entity.output\", -10.0, 10.0]',\n },\n 'tensor/clampPerDim': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Clamp each dimension to its specified range',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'ranges', type: 'object', description: 'Per-dimension ranges { \"0\": {min, max}, ... }' },\n ],\n example: '[\"tensor/clampPerDim\", \"@entity.rawOutput\", \"@entity.outputContract.ranges\"]',\n },\n 'tensor/outOfRangeDims': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get dimensions that exceed their specified ranges',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'ranges', type: 'object', description: 'Per-dimension ranges { \"0\": {min, max}, ... }' },\n ],\n example: '[\"tensor/outOfRangeDims\", \"@entity.rawOutput\", \"@entity.outputContract.ranges\"]',\n },\n\n // ============================================================================\n // Conversion\n // ============================================================================\n\n 'tensor/toArray': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Convert tensor to nested array',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/toArray\", \"@entity.output\"]',\n },\n 'tensor/toList': {\n module: 'tensor',\n category: 'std-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Convert 1D tensor to flat array',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor (must be 1D)' },\n ],\n example: '[\"tensor/toList\", \"@entity.output\"]',\n },\n};\n\n/**\n * Get all tensor operator names.\n */\nexport function getTensorOperators(): string[] {\n return Object.keys(TENSOR_OPERATORS);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../modules/tensor.ts"],"names":[],"mappings":";AAgBO,IAAM,gBAAA,GAAoD;AAAA;AAAA;AAAA;AAAA,EAK/D,aAAA,EAAe;AAAA,IACb,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,0BAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,aAAa,wDAAA;AAAyD,KACvG;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,cAAA,EAAgB;AAAA,IACd,MAAA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a,YAAA;AAAa,KAC9D;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,iCAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,UAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,yBAAA;AAA0B,KAC3E;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,kBAAA,GAA+B;AAC7C,EAAA,OAAO,MAAA,CAAO,KAAK,gBAAgB,CAAA;AACrC","file":"tensor.js","sourcesContent":["/**\n * Tensor Module - Tensor Operations\n *\n * Provides operators for creating and manipulating tensors.\n * Tensors are multi-dimensional arrays used for neural network inputs/outputs.\n * Compiled to native tensor libraries (PyTorch, NumPy, etc.) by the Rust compiler.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Tensor module operators.\n * These operators create and manipulate tensors.\n */\nexport const TENSOR_OPERATORS: Record<string, StdOperatorMeta> = {\n // ============================================================================\n // Creation\n // ============================================================================\n\n 'tensor/from': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor from array',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'data', type: 'array', description: 'Array of numbers (can be nested for multi-dimensional)' },\n ],\n example: '[\"tensor/from\", [1.0, 2.0, 3.0]]',\n },\n 'tensor/zeros': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor filled with zeros',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/zeros\", [3, 4]] // 3x4 tensor of zeros',\n },\n 'tensor/ones': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor filled with ones',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/ones\", [3, 4]] // 3x4 tensor of ones',\n },\n 'tensor/rand': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor with random values in [0, 1)',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/rand\", [16]] // Random 16-element vector',\n },\n 'tensor/randn': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Create tensor with random values from standard normal distribution',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'shape', type: 'number[]', description: 'Shape of the tensor' },\n ],\n example: '[\"tensor/randn\", [16]] // Random normal 16-element vector',\n },\n\n // ============================================================================\n // Shape & Indexing\n // ============================================================================\n\n 'tensor/shape': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Get tensor shape as array',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/shape\", \"@entity.sensors\"] // => [16]',\n },\n 'tensor/get': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get element at index',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'index', type: 'number | number[]', description: 'Index (single for 1D, array for multi-D)' },\n ],\n example: '[\"tensor/get\", \"@entity.output\", 3] // Get 4th element',\n },\n 'tensor/slice': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 3,\n maxArity: 3,\n description: 'Get slice of tensor',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'start', type: 'number', description: 'Start index' },\n { name: 'end', type: 'number', description: 'End index (exclusive)' },\n ],\n example: '[\"tensor/slice\", \"@entity.output\", 0, 3] // First 3 elements',\n },\n 'tensor/reshape': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Reshape tensor to new shape (total elements must match)',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'shape', type: 'number[]', description: 'New shape' },\n ],\n example: '[\"tensor/reshape\", \"@entity.data\", [4, 4]] // Reshape to 4x4',\n },\n 'tensor/flatten': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Flatten tensor to 1D',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/flatten\", \"@entity.data\"]',\n },\n\n // ============================================================================\n // Math Operations\n // ============================================================================\n\n 'tensor/add': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise addition',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/add\", \"@entity.a\", \"@entity.b\"]',\n },\n 'tensor/sub': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise subtraction',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/sub\", \"@entity.a\", \"@entity.b\"]',\n },\n 'tensor/mul': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise multiplication',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/mul\", \"@entity.weights\", 0.99] // Decay weights',\n },\n 'tensor/div': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Element-wise division',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor' },\n { name: 'b', type: 'tensor | number', description: 'Second tensor or scalar' },\n ],\n example: '[\"tensor/div\", \"@entity.gradient\", \"@entity.batchSize\"]',\n },\n 'tensor/matmul': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Matrix multiplication',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'a', type: 'tensor', description: 'First tensor (NxM)' },\n { name: 'b', type: 'tensor', description: 'Second tensor (MxK)' },\n ],\n example: '[\"tensor/matmul\", \"@entity.input\", \"@entity.weights\"]',\n },\n 'tensor/dot': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Dot product of two 1D tensors',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'a', type: 'tensor', description: 'First vector' },\n { name: 'b', type: 'tensor', description: 'Second vector' },\n ],\n example: '[\"tensor/dot\", \"@entity.a\", \"@entity.b\"]',\n },\n\n // ============================================================================\n // Reductions\n // ============================================================================\n\n 'tensor/sum': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Sum of tensor elements',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/sum\", \"@entity.rewards\"] // Total reward',\n },\n 'tensor/mean': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Mean of tensor elements',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/mean\", \"@entity.losses\"]',\n },\n 'tensor/max': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Maximum value in tensor',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/max\", \"@entity.qValues\"]',\n },\n 'tensor/min': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Minimum value in tensor',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/min\", \"@entity.distances\"]',\n },\n 'tensor/argmax': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'Index of maximum value',\n hasSideEffects: false,\n returnType: 'number | tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'dim', type: 'number', description: 'Dimension to reduce', optional: true },\n ],\n example: '[\"tensor/argmax\", \"@entity.qValues\"] // Best action index',\n },\n 'tensor/norm': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 2,\n description: 'L2 norm of tensor',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'p', type: 'number', description: 'Norm order (default 2)', optional: true, defaultValue: 2 },\n ],\n example: '[\"tensor/norm\", \"@entity.gradient\"]',\n },\n\n // ============================================================================\n // Range Validation (for contracts)\n // ============================================================================\n\n 'tensor/allInRange': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Check if all elements are within range [min, max]',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'range', type: '[number, number]', description: 'Range as [min, max]' },\n ],\n example: '[\"tensor/allInRange\", \"@payload.input\", [-1.0, 1.0]]',\n },\n 'tensor/outOfRangeIndices': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get indices of elements outside range',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'range', type: '[number, number]', description: 'Range as [min, max]' },\n ],\n example: '[\"tensor/outOfRangeIndices\", \"@payload.input\", [-1.0, 1.0]]',\n },\n 'tensor/clamp': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 3,\n maxArity: 3,\n description: 'Clamp all elements to range [min, max]',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'min', type: 'number', description: 'Minimum value' },\n { name: 'max', type: 'number', description: 'Maximum value' },\n ],\n example: '[\"tensor/clamp\", \"@entity.output\", -10.0, 10.0]',\n },\n 'tensor/clampPerDim': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Clamp each dimension to its specified range',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'ranges', type: 'object', description: 'Per-dimension ranges { \"0\": {min, max}, ... }' },\n ],\n example: '[\"tensor/clampPerDim\", \"@entity.rawOutput\", \"@entity.outputContract.ranges\"]',\n },\n 'tensor/outOfRangeDims': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 2,\n maxArity: 2,\n description: 'Get dimensions that exceed their specified ranges',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n { name: 'ranges', type: 'object', description: 'Per-dimension ranges { \"0\": {min, max}, ... }' },\n ],\n example: '[\"tensor/outOfRangeDims\", \"@entity.rawOutput\", \"@entity.outputContract.ranges\"]',\n },\n\n // ============================================================================\n // Conversion\n // ============================================================================\n\n 'tensor/toArray': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Convert tensor to nested array',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor' },\n ],\n example: '[\"tensor/toArray\", \"@entity.output\"]',\n },\n 'tensor/toList': {\n module: 'tensor',\n category: 'ml-tensor',\n minArity: 1,\n maxArity: 1,\n description: 'Convert 1D tensor to flat array',\n hasSideEffects: false,\n returnType: 'number[]',\n params: [\n { name: 'tensor', type: 'tensor', description: 'The tensor (must be 1D)' },\n ],\n example: '[\"tensor/toList\", \"@entity.output\"]',\n },\n};\n\n/**\n * Get all tensor operator names.\n */\nexport function getTensorOperators(): string[] {\n return Object.keys(TENSOR_OPERATORS);\n}\n"]}
|
package/dist/modules/time.d.ts
CHANGED
package/dist/modules/train.d.ts
CHANGED
package/dist/modules/train.js
CHANGED
|
@@ -5,7 +5,7 @@ var TRAIN_OPERATORS = {
|
|
|
5
5
|
// ============================================================================
|
|
6
6
|
"train/loop": {
|
|
7
7
|
module: "train",
|
|
8
|
-
category: "
|
|
8
|
+
category: "ml-effect",
|
|
9
9
|
minArity: 3,
|
|
10
10
|
maxArity: 3,
|
|
11
11
|
description: "Execute training loop with constraints",
|
|
@@ -20,7 +20,7 @@ var TRAIN_OPERATORS = {
|
|
|
20
20
|
},
|
|
21
21
|
"train/step": {
|
|
22
22
|
module: "train",
|
|
23
|
-
category: "
|
|
23
|
+
category: "ml-effect",
|
|
24
24
|
minArity: 4,
|
|
25
25
|
maxArity: 4,
|
|
26
26
|
description: "Execute single training step (forward, loss, backward, update)",
|
|
@@ -39,7 +39,7 @@ var TRAIN_OPERATORS = {
|
|
|
39
39
|
// ============================================================================
|
|
40
40
|
"train/validate": {
|
|
41
41
|
module: "train",
|
|
42
|
-
category: "
|
|
42
|
+
category: "ml-effect",
|
|
43
43
|
minArity: 2,
|
|
44
44
|
maxArity: 2,
|
|
45
45
|
description: "Validate model on test cases, returns pass/fail metrics",
|
|
@@ -53,7 +53,7 @@ var TRAIN_OPERATORS = {
|
|
|
53
53
|
},
|
|
54
54
|
"train/checkRegression": {
|
|
55
55
|
module: "train",
|
|
56
|
-
category: "
|
|
56
|
+
category: "ml-effect",
|
|
57
57
|
minArity: 3,
|
|
58
58
|
maxArity: 3,
|
|
59
59
|
description: "Check if new model regresses on required invariants",
|
|
@@ -71,7 +71,7 @@ var TRAIN_OPERATORS = {
|
|
|
71
71
|
// ============================================================================
|
|
72
72
|
"train/checkConstraints": {
|
|
73
73
|
module: "train",
|
|
74
|
-
category: "
|
|
74
|
+
category: "ml-effect",
|
|
75
75
|
minArity: 2,
|
|
76
76
|
maxArity: 2,
|
|
77
77
|
description: "Check if network weights satisfy all constraints",
|
|
@@ -85,7 +85,7 @@ var TRAIN_OPERATORS = {
|
|
|
85
85
|
},
|
|
86
86
|
"train/checkWeightMagnitude": {
|
|
87
87
|
module: "train",
|
|
88
|
-
category: "
|
|
88
|
+
category: "ml-effect",
|
|
89
89
|
minArity: 2,
|
|
90
90
|
maxArity: 2,
|
|
91
91
|
description: "Check if all weights are within magnitude limit",
|
|
@@ -99,7 +99,7 @@ var TRAIN_OPERATORS = {
|
|
|
99
99
|
},
|
|
100
100
|
"train/checkForbiddenOutputs": {
|
|
101
101
|
module: "train",
|
|
102
|
-
category: "
|
|
102
|
+
category: "ml-effect",
|
|
103
103
|
minArity: 3,
|
|
104
104
|
maxArity: 3,
|
|
105
105
|
description: "Check if model produces outputs in forbidden regions",
|
|
@@ -117,7 +117,7 @@ var TRAIN_OPERATORS = {
|
|
|
117
117
|
// ============================================================================
|
|
118
118
|
"train/clipGradients": {
|
|
119
119
|
module: "train",
|
|
120
|
-
category: "
|
|
120
|
+
category: "ml-effect",
|
|
121
121
|
minArity: 2,
|
|
122
122
|
maxArity: 2,
|
|
123
123
|
description: "Clip gradients to max norm (modifies in place)",
|
|
@@ -131,7 +131,7 @@ var TRAIN_OPERATORS = {
|
|
|
131
131
|
},
|
|
132
132
|
"train/getGradientNorm": {
|
|
133
133
|
module: "train",
|
|
134
|
-
category: "
|
|
134
|
+
category: "ml-effect",
|
|
135
135
|
minArity: 1,
|
|
136
136
|
maxArity: 1,
|
|
137
137
|
description: "Get current gradient norm",
|
|
@@ -147,7 +147,7 @@ var TRAIN_OPERATORS = {
|
|
|
147
147
|
// ============================================================================
|
|
148
148
|
"train/clipWeights": {
|
|
149
149
|
module: "train",
|
|
150
|
-
category: "
|
|
150
|
+
category: "ml-effect",
|
|
151
151
|
minArity: 2,
|
|
152
152
|
maxArity: 2,
|
|
153
153
|
description: "Clip weights to max magnitude (modifies in place)",
|
|
@@ -161,7 +161,7 @@ var TRAIN_OPERATORS = {
|
|
|
161
161
|
},
|
|
162
162
|
"train/getMaxWeightMagnitude": {
|
|
163
163
|
module: "train",
|
|
164
|
-
category: "
|
|
164
|
+
category: "ml-effect",
|
|
165
165
|
minArity: 1,
|
|
166
166
|
maxArity: 1,
|
|
167
167
|
description: "Get maximum weight magnitude in network",
|
|
@@ -177,7 +177,7 @@ var TRAIN_OPERATORS = {
|
|
|
177
177
|
// ============================================================================
|
|
178
178
|
"train/mse": {
|
|
179
179
|
module: "train",
|
|
180
|
-
category: "
|
|
180
|
+
category: "ml-effect",
|
|
181
181
|
minArity: 2,
|
|
182
182
|
maxArity: 2,
|
|
183
183
|
description: "Mean squared error loss",
|
|
@@ -191,7 +191,7 @@ var TRAIN_OPERATORS = {
|
|
|
191
191
|
},
|
|
192
192
|
"train/crossEntropy": {
|
|
193
193
|
module: "train",
|
|
194
|
-
category: "
|
|
194
|
+
category: "ml-effect",
|
|
195
195
|
minArity: 2,
|
|
196
196
|
maxArity: 2,
|
|
197
197
|
description: "Cross-entropy loss for classification",
|
|
@@ -205,7 +205,7 @@ var TRAIN_OPERATORS = {
|
|
|
205
205
|
},
|
|
206
206
|
"train/huber": {
|
|
207
207
|
module: "train",
|
|
208
|
-
category: "
|
|
208
|
+
category: "ml-effect",
|
|
209
209
|
minArity: 2,
|
|
210
210
|
maxArity: 3,
|
|
211
211
|
description: "Huber loss (smooth L1, robust to outliers)",
|
|
@@ -223,7 +223,7 @@ var TRAIN_OPERATORS = {
|
|
|
223
223
|
// ============================================================================
|
|
224
224
|
"train/sgd": {
|
|
225
225
|
module: "train",
|
|
226
|
-
category: "
|
|
226
|
+
category: "ml-effect",
|
|
227
227
|
minArity: 2,
|
|
228
228
|
maxArity: 3,
|
|
229
229
|
description: "Stochastic gradient descent optimizer step",
|
|
@@ -238,7 +238,7 @@ var TRAIN_OPERATORS = {
|
|
|
238
238
|
},
|
|
239
239
|
"train/adam": {
|
|
240
240
|
module: "train",
|
|
241
|
-
category: "
|
|
241
|
+
category: "ml-effect",
|
|
242
242
|
minArity: 2,
|
|
243
243
|
maxArity: 4,
|
|
244
244
|
description: "Adam optimizer step",
|
|
@@ -257,7 +257,7 @@ var TRAIN_OPERATORS = {
|
|
|
257
257
|
// ============================================================================
|
|
258
258
|
"train/sampleBatch": {
|
|
259
259
|
module: "train",
|
|
260
|
-
category: "
|
|
260
|
+
category: "ml-effect",
|
|
261
261
|
minArity: 2,
|
|
262
262
|
maxArity: 2,
|
|
263
263
|
description: "Sample random batch from experience buffer",
|
|
@@ -271,7 +271,7 @@ var TRAIN_OPERATORS = {
|
|
|
271
271
|
},
|
|
272
272
|
"train/computeReturns": {
|
|
273
273
|
module: "train",
|
|
274
|
-
category: "
|
|
274
|
+
category: "ml-effect",
|
|
275
275
|
minArity: 2,
|
|
276
276
|
maxArity: 2,
|
|
277
277
|
description: "Compute discounted returns from rewards",
|
|
@@ -285,7 +285,7 @@ var TRAIN_OPERATORS = {
|
|
|
285
285
|
},
|
|
286
286
|
"train/computeAdvantages": {
|
|
287
287
|
module: "train",
|
|
288
|
-
category: "
|
|
288
|
+
category: "ml-effect",
|
|
289
289
|
minArity: 3,
|
|
290
290
|
maxArity: 3,
|
|
291
291
|
description: "Compute GAE advantages for policy gradient",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../modules/train.ts"],"names":[],"mappings":";AAgBO,IAAM,eAAA,GAAmD;AAAA;AAAA;AAAA;AAAA,EAK9D,YAAA,EAAc;AAAA,IACZ,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,wCAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,cAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,6BAAA,EAA8B;AAAA,MAChF,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,aAAa,yDAAA,EAA0D;AAAA,MACtG,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,cAAA,EAAgB,aAAa,yCAAA;AAA0C,KACjG;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,gEAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,kBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,oBAAA,EAAqB;AAAA,MACvE,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,QA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A;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,OAAA,EAAS,aAAa,kBAAA,EAAmB;AAAA,MAClE,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,iBAAA,EAAkB;AAAA,MACjE,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,2BAAA;AAA4B,KAC7E;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,iBAAA,GAA8B;AAC5C,EAAA,OAAO,MAAA,CAAO,KAAK,eAAe,CAAA;AACpC","file":"train.js","sourcesContent":["/**\n * Training Module - Neural Network Training Operations\n *\n * Provides operators for training neural networks with explicit constraints.\n * Training is bounded by readable rules: gradient clipping, weight constraints,\n * forbidden output regions, and validation gates.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Training module operators.\n * These operators handle training loops, validation, and constraint enforcement.\n */\nexport const TRAIN_OPERATORS: Record<string, StdOperatorMeta> = {\n // ============================================================================\n // Training Loop\n // ============================================================================\n\n 'train/loop': {\n module: 'train',\n category: 'std-train',\n minArity: 3,\n maxArity: 3,\n description: 'Execute training loop with constraints',\n hasSideEffects: true,\n returnType: 'train/result',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network to train' },\n { name: 'data', type: 'array', description: 'Training data (array of {input, target} or experiences)' },\n { name: 'config', type: 'train/config', description: 'Training configuration with constraints' },\n ],\n example: '[\"train/loop\", \"@entity.architecture\", \"@entity.buffer\", \"@entity.trainingConfig\"]',\n },\n 'train/step': {\n module: 'train',\n category: 'std-train',\n minArity: 4,\n maxArity: 4,\n description: 'Execute single training step (forward, loss, backward, update)',\n hasSideEffects: true,\n returnType: 'train/stepResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'input', type: 'tensor', description: 'Input tensor' },\n { name: 'target', type: 'tensor', description: 'Target tensor' },\n { name: 'config', type: 'train/config', description: 'Training configuration' },\n ],\n example: '[\"train/step\", \"@entity.architecture\", \"@batch.input\", \"@batch.target\", \"@entity.config\"]',\n },\n\n // ============================================================================\n // Validation\n // ============================================================================\n\n 'train/validate': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Validate model on test cases, returns pass/fail metrics',\n hasSideEffects: false,\n returnType: 'train/validationResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'testCases', type: 'array', description: 'Array of {input, expected, tolerance?}' },\n ],\n example: '[\"train/validate\", \"@entity.architecture\", \"@entity.validationSet\"]',\n },\n 'train/checkRegression': {\n module: 'train',\n category: 'std-train',\n minArity: 3,\n maxArity: 3,\n description: 'Check if new model regresses on required invariants',\n hasSideEffects: false,\n returnType: 'train/regressionResult',\n params: [\n { name: 'newModule', type: 'nn/module', description: 'Newly trained network' },\n { name: 'oldModule', type: 'nn/module', description: 'Previous network' },\n { name: 'invariants', type: 'array', description: 'Test cases that must not regress' },\n ],\n example: '[\"train/checkRegression\", \"@payload.newWeights\", \"@entity.architecture\", \"@entity.requiredInvariants\"]',\n },\n\n // ============================================================================\n // Constraint Checking\n // ============================================================================\n\n 'train/checkConstraints': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Check if network weights satisfy all constraints',\n hasSideEffects: false,\n returnType: 'train/constraintResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'constraints', type: 'train/constraints', description: 'Constraint specification' },\n ],\n example: '[\"train/checkConstraints\", \"@payload.newWeights\", \"@entity.constraints\"]',\n },\n 'train/checkWeightMagnitude': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Check if all weights are within magnitude limit',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxMagnitude', type: 'number', description: 'Maximum allowed weight magnitude' },\n ],\n example: '[\"train/checkWeightMagnitude\", \"@entity.architecture\", 10.0]',\n },\n 'train/checkForbiddenOutputs': {\n module: 'train',\n category: 'std-train',\n minArity: 3,\n maxArity: 3,\n description: 'Check if model produces outputs in forbidden regions',\n hasSideEffects: false,\n returnType: 'train/forbiddenResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'testInputs', type: 'array', description: 'Inputs to test' },\n { name: 'forbiddenRegions', type: 'array', description: 'Forbidden output regions' },\n ],\n example: '[\"train/checkForbiddenOutputs\", \"@entity.architecture\", \"@entity.testInputs\", \"@entity.forbiddenOutputRegions\"]',\n },\n\n // ============================================================================\n // Gradient Operations\n // ============================================================================\n\n 'train/clipGradients': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Clip gradients to max norm (modifies in place)',\n hasSideEffects: true,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxNorm', type: 'number', description: 'Maximum gradient norm' },\n ],\n example: '[\"train/clipGradients\", \"@entity.architecture\", 1.0]',\n },\n 'train/getGradientNorm': {\n module: 'train',\n category: 'std-train',\n minArity: 1,\n maxArity: 1,\n description: 'Get current gradient norm',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n ],\n example: '[\"train/getGradientNorm\", \"@entity.architecture\"]',\n },\n\n // ============================================================================\n // Weight Operations\n // ============================================================================\n\n 'train/clipWeights': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Clip weights to max magnitude (modifies in place)',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxMagnitude', type: 'number', description: 'Maximum weight magnitude' },\n ],\n example: '[\"train/clipWeights\", \"@entity.architecture\", 10.0]',\n },\n 'train/getMaxWeightMagnitude': {\n module: 'train',\n category: 'std-train',\n minArity: 1,\n maxArity: 1,\n description: 'Get maximum weight magnitude in network',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n ],\n example: '[\"train/getMaxWeightMagnitude\", \"@entity.architecture\"]',\n },\n\n // ============================================================================\n // Loss Functions\n // ============================================================================\n\n 'train/mse': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Mean squared error loss',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'predicted', type: 'tensor', description: 'Predicted values' },\n { name: 'target', type: 'tensor', description: 'Target values' },\n ],\n example: '[\"train/mse\", \"@entity.output\", \"@batch.target\"]',\n },\n 'train/crossEntropy': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Cross-entropy loss for classification',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'logits', type: 'tensor', description: 'Raw model outputs (logits)' },\n { name: 'labels', type: 'tensor', description: 'Target class labels' },\n ],\n example: '[\"train/crossEntropy\", \"@entity.logits\", \"@batch.labels\"]',\n },\n 'train/huber': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 3,\n description: 'Huber loss (smooth L1, robust to outliers)',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'predicted', type: 'tensor', description: 'Predicted values' },\n { name: 'target', type: 'tensor', description: 'Target values' },\n { name: 'delta', type: 'number', description: 'Threshold for quadratic vs linear', optional: true, defaultValue: 1.0 },\n ],\n example: '[\"train/huber\", \"@entity.qValues\", \"@batch.targets\", 1.0]',\n },\n\n // ============================================================================\n // Optimizers\n // ============================================================================\n\n 'train/sgd': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 3,\n description: 'Stochastic gradient descent optimizer step',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'lr', type: 'number', description: 'Learning rate' },\n { name: 'momentum', type: 'number', description: 'Momentum factor', optional: true, defaultValue: 0 },\n ],\n example: '[\"train/sgd\", \"@entity.architecture\", 0.01, 0.9]',\n },\n 'train/adam': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 4,\n description: 'Adam optimizer step',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'lr', type: 'number', description: 'Learning rate' },\n { name: 'beta1', type: 'number', description: 'First moment decay', optional: true, defaultValue: 0.9 },\n { name: 'beta2', type: 'number', description: 'Second moment decay', optional: true, defaultValue: 0.999 },\n ],\n example: '[\"train/adam\", \"@entity.architecture\", 0.001]',\n },\n\n // ============================================================================\n // Experience Replay (for RL)\n // ============================================================================\n\n 'train/sampleBatch': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Sample random batch from experience buffer',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'buffer', type: 'array', description: 'Experience buffer' },\n { name: 'batchSize', type: 'number', description: 'Number of samples' },\n ],\n example: '[\"train/sampleBatch\", \"@entity.experienceBuffer\", 32]',\n },\n 'train/computeReturns': {\n module: 'train',\n category: 'std-train',\n minArity: 2,\n maxArity: 2,\n description: 'Compute discounted returns from rewards',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'rewards', type: 'array', description: 'Array of rewards' },\n { name: 'gamma', type: 'number', description: 'Discount factor' },\n ],\n example: '[\"train/computeReturns\", \"@episode.rewards\", 0.99]',\n },\n 'train/computeAdvantages': {\n module: 'train',\n category: 'std-train',\n minArity: 3,\n maxArity: 3,\n description: 'Compute GAE advantages for policy gradient',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'rewards', type: 'array', description: 'Array of rewards' },\n { name: 'values', type: 'tensor', description: 'Value estimates' },\n { name: 'config', type: 'object', description: 'Config with gamma, lambda' },\n ],\n example: '[\"train/computeAdvantages\", \"@episode.rewards\", \"@episode.values\", { \"gamma\": 0.99, \"lambda\": 0.95 }]',\n },\n};\n\n/**\n * Get all train operator names.\n */\nexport function getTrainOperators(): string[] {\n return Object.keys(TRAIN_OPERATORS);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../modules/train.ts"],"names":[],"mappings":";AAgBO,IAAM,eAAA,GAAmD;AAAA;AAAA;AAAA;AAAA,EAK9D,YAAA,EAAc;AAAA,IACZ,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,wCAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,cAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,6BAAA,EAA8B;AAAA,MAChF,EAAE,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,OAAA,EAAS,aAAa,yDAAA,EAA0D;AAAA,MACtG,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,cAAA,EAAgB,aAAa,yCAAA;AAA0C,KACjG;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AAAA,EACA,YAAA,EAAc;AAAA,IACZ,MAAA,EAAQ,OAAA;AAAA,IACR,QAAA,EAAU,WAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,gEAAA;AAAA,IACb,cAAA,EAAgB,IAAA;AAAA,IAChB,UAAA,EAAY,kBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAA,EAAa,aAAa,oBAAA,EAAqB;AAAA,MACvE,EAAE,IAAA,EAAM,OAAA,EAAS,IAAA,EAAM,QAAA,EAAU,aAAa,cAAA,EAAe;AAAA,MAC7D,EAAE,IAA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EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,MACN,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,OAAA,EAAS,aAAa,kBAAA,EAAmB;AAAA,MAClE,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,iBAAA,EAAkB;AAAA,MACjE,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,2BAAA;AAA4B,KAC7E;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,iBAAA,GAA8B;AAC5C,EAAA,OAAO,MAAA,CAAO,KAAK,eAAe,CAAA;AACpC","file":"train.js","sourcesContent":["/**\n * Training Module - Neural Network Training Operations\n *\n * Provides operators for training neural networks with explicit constraints.\n * Training is bounded by readable rules: gradient clipping, weight constraints,\n * forbidden output regions, and validation gates.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * Training module operators.\n * These operators handle training loops, validation, and constraint enforcement.\n */\nexport const TRAIN_OPERATORS: Record<string, StdOperatorMeta> = {\n // ============================================================================\n // Training Loop\n // ============================================================================\n\n 'train/loop': {\n module: 'train',\n category: 'ml-effect',\n minArity: 3,\n maxArity: 3,\n description: 'Execute training loop with constraints',\n hasSideEffects: true,\n returnType: 'train/result',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network to train' },\n { name: 'data', type: 'array', description: 'Training data (array of {input, target} or experiences)' },\n { name: 'config', type: 'train/config', description: 'Training configuration with constraints' },\n ],\n example: '[\"train/loop\", \"@entity.architecture\", \"@entity.buffer\", \"@entity.trainingConfig\"]',\n },\n 'train/step': {\n module: 'train',\n category: 'ml-effect',\n minArity: 4,\n maxArity: 4,\n description: 'Execute single training step (forward, loss, backward, update)',\n hasSideEffects: true,\n returnType: 'train/stepResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'input', type: 'tensor', description: 'Input tensor' },\n { name: 'target', type: 'tensor', description: 'Target tensor' },\n { name: 'config', type: 'train/config', description: 'Training configuration' },\n ],\n example: '[\"train/step\", \"@entity.architecture\", \"@batch.input\", \"@batch.target\", \"@entity.config\"]',\n },\n\n // ============================================================================\n // Validation\n // ============================================================================\n\n 'train/validate': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Validate model on test cases, returns pass/fail metrics',\n hasSideEffects: false,\n returnType: 'train/validationResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'testCases', type: 'array', description: 'Array of {input, expected, tolerance?}' },\n ],\n example: '[\"train/validate\", \"@entity.architecture\", \"@entity.validationSet\"]',\n },\n 'train/checkRegression': {\n module: 'train',\n category: 'ml-effect',\n minArity: 3,\n maxArity: 3,\n description: 'Check if new model regresses on required invariants',\n hasSideEffects: false,\n returnType: 'train/regressionResult',\n params: [\n { name: 'newModule', type: 'nn/module', description: 'Newly trained network' },\n { name: 'oldModule', type: 'nn/module', description: 'Previous network' },\n { name: 'invariants', type: 'array', description: 'Test cases that must not regress' },\n ],\n example: '[\"train/checkRegression\", \"@payload.newWeights\", \"@entity.architecture\", \"@entity.requiredInvariants\"]',\n },\n\n // ============================================================================\n // Constraint Checking\n // ============================================================================\n\n 'train/checkConstraints': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Check if network weights satisfy all constraints',\n hasSideEffects: false,\n returnType: 'train/constraintResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'constraints', type: 'train/constraints', description: 'Constraint specification' },\n ],\n example: '[\"train/checkConstraints\", \"@payload.newWeights\", \"@entity.constraints\"]',\n },\n 'train/checkWeightMagnitude': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Check if all weights are within magnitude limit',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxMagnitude', type: 'number', description: 'Maximum allowed weight magnitude' },\n ],\n example: '[\"train/checkWeightMagnitude\", \"@entity.architecture\", 10.0]',\n },\n 'train/checkForbiddenOutputs': {\n module: 'train',\n category: 'ml-effect',\n minArity: 3,\n maxArity: 3,\n description: 'Check if model produces outputs in forbidden regions',\n hasSideEffects: false,\n returnType: 'train/forbiddenResult',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'testInputs', type: 'array', description: 'Inputs to test' },\n { name: 'forbiddenRegions', type: 'array', description: 'Forbidden output regions' },\n ],\n example: '[\"train/checkForbiddenOutputs\", \"@entity.architecture\", \"@entity.testInputs\", \"@entity.forbiddenOutputRegions\"]',\n },\n\n // ============================================================================\n // Gradient Operations\n // ============================================================================\n\n 'train/clipGradients': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Clip gradients to max norm (modifies in place)',\n hasSideEffects: true,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxNorm', type: 'number', description: 'Maximum gradient norm' },\n ],\n example: '[\"train/clipGradients\", \"@entity.architecture\", 1.0]',\n },\n 'train/getGradientNorm': {\n module: 'train',\n category: 'ml-effect',\n minArity: 1,\n maxArity: 1,\n description: 'Get current gradient norm',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n ],\n example: '[\"train/getGradientNorm\", \"@entity.architecture\"]',\n },\n\n // ============================================================================\n // Weight Operations\n // ============================================================================\n\n 'train/clipWeights': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Clip weights to max magnitude (modifies in place)',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'maxMagnitude', type: 'number', description: 'Maximum weight magnitude' },\n ],\n example: '[\"train/clipWeights\", \"@entity.architecture\", 10.0]',\n },\n 'train/getMaxWeightMagnitude': {\n module: 'train',\n category: 'ml-effect',\n minArity: 1,\n maxArity: 1,\n description: 'Get maximum weight magnitude in network',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n ],\n example: '[\"train/getMaxWeightMagnitude\", \"@entity.architecture\"]',\n },\n\n // ============================================================================\n // Loss Functions\n // ============================================================================\n\n 'train/mse': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Mean squared error loss',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'predicted', type: 'tensor', description: 'Predicted values' },\n { name: 'target', type: 'tensor', description: 'Target values' },\n ],\n example: '[\"train/mse\", \"@entity.output\", \"@batch.target\"]',\n },\n 'train/crossEntropy': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Cross-entropy loss for classification',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'logits', type: 'tensor', description: 'Raw model outputs (logits)' },\n { name: 'labels', type: 'tensor', description: 'Target class labels' },\n ],\n example: '[\"train/crossEntropy\", \"@entity.logits\", \"@batch.labels\"]',\n },\n 'train/huber': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 3,\n description: 'Huber loss (smooth L1, robust to outliers)',\n hasSideEffects: false,\n returnType: 'number',\n params: [\n { name: 'predicted', type: 'tensor', description: 'Predicted values' },\n { name: 'target', type: 'tensor', description: 'Target values' },\n { name: 'delta', type: 'number', description: 'Threshold for quadratic vs linear', optional: true, defaultValue: 1.0 },\n ],\n example: '[\"train/huber\", \"@entity.qValues\", \"@batch.targets\", 1.0]',\n },\n\n // ============================================================================\n // Optimizers\n // ============================================================================\n\n 'train/sgd': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 3,\n description: 'Stochastic gradient descent optimizer step',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'lr', type: 'number', description: 'Learning rate' },\n { name: 'momentum', type: 'number', description: 'Momentum factor', optional: true, defaultValue: 0 },\n ],\n example: '[\"train/sgd\", \"@entity.architecture\", 0.01, 0.9]',\n },\n 'train/adam': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 4,\n description: 'Adam optimizer step',\n hasSideEffects: true,\n returnType: 'void',\n params: [\n { name: 'module', type: 'nn/module', description: 'The neural network' },\n { name: 'lr', type: 'number', description: 'Learning rate' },\n { name: 'beta1', type: 'number', description: 'First moment decay', optional: true, defaultValue: 0.9 },\n { name: 'beta2', type: 'number', description: 'Second moment decay', optional: true, defaultValue: 0.999 },\n ],\n example: '[\"train/adam\", \"@entity.architecture\", 0.001]',\n },\n\n // ============================================================================\n // Experience Replay (for RL)\n // ============================================================================\n\n 'train/sampleBatch': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Sample random batch from experience buffer',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 'buffer', type: 'array', description: 'Experience buffer' },\n { name: 'batchSize', type: 'number', description: 'Number of samples' },\n ],\n example: '[\"train/sampleBatch\", \"@entity.experienceBuffer\", 32]',\n },\n 'train/computeReturns': {\n module: 'train',\n category: 'ml-effect',\n minArity: 2,\n maxArity: 2,\n description: 'Compute discounted returns from rewards',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'rewards', type: 'array', description: 'Array of rewards' },\n { name: 'gamma', type: 'number', description: 'Discount factor' },\n ],\n example: '[\"train/computeReturns\", \"@episode.rewards\", 0.99]',\n },\n 'train/computeAdvantages': {\n module: 'train',\n category: 'ml-effect',\n minArity: 3,\n maxArity: 3,\n description: 'Compute GAE advantages for policy gradient',\n hasSideEffects: false,\n returnType: 'tensor',\n params: [\n { name: 'rewards', type: 'array', description: 'Array of rewards' },\n { name: 'values', type: 'tensor', description: 'Value estimates' },\n { name: 'config', type: 'object', description: 'Config with gamma, lambda' },\n ],\n example: '[\"train/computeAdvantages\", \"@episode.rewards\", \"@episode.values\", { \"gamma\": 0.99, \"lambda\": 0.95 }]',\n },\n};\n\n/**\n * Get all train operator names.\n */\nexport function getTrainOperators(): string[] {\n return Object.keys(TRAIN_OPERATORS);\n}\n"]}
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OperatorMeta } from '@almadar/core/types';
|
|
2
|
-
import { a as StdOperatorMeta, S as StdModule } from './types-
|
|
2
|
+
import { a as StdOperatorMeta, S as StdModule } from './types-DOeGXRCm.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Standard Library Registry
|
|
@@ -17,7 +17,7 @@ declare const STD_OPERATORS: Record<string, StdOperatorMeta>;
|
|
|
17
17
|
/**
|
|
18
18
|
* Module-specific operator registries.
|
|
19
19
|
*/
|
|
20
|
-
declare const STD_OPERATORS_BY_MODULE: Record<
|
|
20
|
+
declare const STD_OPERATORS_BY_MODULE: Record<string, Record<string, StdOperatorMeta>>;
|
|
21
21
|
/**
|
|
22
22
|
* Get std operator metadata by name.
|
|
23
23
|
*
|