@almadar/std 1.0.0
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 -0
- package/dist/behaviors/action-affinity.d.ts +88 -0
- package/dist/behaviors/action-affinity.js +290 -0
- package/dist/behaviors/action-affinity.js.map +1 -0
- package/dist/behaviors/async.d.ts +20 -0
- package/dist/behaviors/async.js +542 -0
- package/dist/behaviors/async.js.map +1 -0
- package/dist/behaviors/data-management.d.ts +40 -0
- package/dist/behaviors/data-management.js +495 -0
- package/dist/behaviors/data-management.js.map +1 -0
- package/dist/behaviors/feedback.d.ts +18 -0
- package/dist/behaviors/feedback.js +307 -0
- package/dist/behaviors/feedback.js.map +1 -0
- package/dist/behaviors/game-core.d.ts +40 -0
- package/dist/behaviors/game-core.js +443 -0
- package/dist/behaviors/game-core.js.map +1 -0
- package/dist/behaviors/game-entity.d.ts +39 -0
- package/dist/behaviors/game-entity.js +643 -0
- package/dist/behaviors/game-entity.js.map +1 -0
- package/dist/behaviors/game-ui.d.ts +29 -0
- package/dist/behaviors/game-ui.js +493 -0
- package/dist/behaviors/game-ui.js.map +1 -0
- package/dist/behaviors/index.d.ts +11 -0
- package/dist/behaviors/index.js +4539 -0
- package/dist/behaviors/index.js.map +1 -0
- package/dist/behaviors/registry.d.ts +103 -0
- package/dist/behaviors/registry.js +4166 -0
- package/dist/behaviors/registry.js.map +1 -0
- package/dist/behaviors/types.d.ts +179 -0
- package/dist/behaviors/types.js +111 -0
- package/dist/behaviors/types.js.map +1 -0
- package/dist/behaviors/ui-interaction.d.ts +36 -0
- package/dist/behaviors/ui-interaction.js +1104 -0
- package/dist/behaviors/ui-interaction.js.map +1 -0
- package/dist/index.d.ts +195 -0
- package/dist/index.js +8209 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/array.d.ts +28 -0
- package/dist/modules/array.js +556 -0
- package/dist/modules/array.js.map +1 -0
- package/dist/modules/async.d.ts +22 -0
- package/dist/modules/async.js +112 -0
- package/dist/modules/async.js.map +1 -0
- package/dist/modules/format.d.ts +21 -0
- package/dist/modules/format.js +129 -0
- package/dist/modules/format.js.map +1 -0
- package/dist/modules/index.d.ts +12 -0
- package/dist/modules/index.js +3131 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/math.d.ts +22 -0
- package/dist/modules/math.js +215 -0
- package/dist/modules/math.js.map +1 -0
- package/dist/modules/nn.d.ts +23 -0
- package/dist/modules/nn.js +189 -0
- package/dist/modules/nn.js.map +1 -0
- package/dist/modules/object.d.ts +22 -0
- package/dist/modules/object.js +257 -0
- package/dist/modules/object.js.map +1 -0
- package/dist/modules/str.d.ts +21 -0
- package/dist/modules/str.js +344 -0
- package/dist/modules/str.js.map +1 -0
- package/dist/modules/tensor.d.ts +23 -0
- package/dist/modules/tensor.js +427 -0
- package/dist/modules/tensor.js.map +1 -0
- package/dist/modules/time.d.ts +24 -0
- package/dist/modules/time.js +323 -0
- package/dist/modules/time.js.map +1 -0
- package/dist/modules/train.d.ts +23 -0
- package/dist/modules/train.js +308 -0
- package/dist/modules/train.js.map +1 -0
- package/dist/modules/validate.d.ts +23 -0
- package/dist/modules/validate.js +301 -0
- package/dist/modules/validate.js.map +1 -0
- package/dist/registry.d.ts +140 -0
- package/dist/registry.js +3240 -0
- package/dist/registry.js.map +1 -0
- package/dist/types-I95R8_FN.d.ts +91 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../modules/str.ts"],"names":[],"mappings":";AAcO,IAAM,aAAA,GAAiD;AAAA,EAC5D,SAAA,EAAW;AAAA,IACT,MAAA,EAAQ,KAAA;AAAA,IACR,QAAA,EAAU,SAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,eAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,QAAA;AAAA,IACZ,MAAA,EAAQ,CAAC,EAAE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AAAA,MACN,EAAE,IAAA,EAAM,GAAA,EAAK,IAAA,EAAM,QAAA,EAAU,aAAa,YAAA,EAAa;AAAA,MACvD,EAAE,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,QAAA,EAAU,aAAa,gBAAA,EAAiB;AAAA,MAC7D,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,aAAa,8BAAA,EAAgC,QAAA,EAAU,IAAA,EAAM,YAAA,EAAc,KAAA;AAAM,KACrH;AAAA,IACA,OAAA,EAAS;AAAA;AAEb;AAKO,SAAS,eAAA,GAA4B;AAC1C,EAAA,OAAO,MAAA,CAAO,KAAK,aAAa,CAAA;AAClC","file":"str.js","sourcesContent":["/**\n * String Module - String Operations\n *\n * Provides string manipulation and transformation functions.\n *\n * @packageDocumentation\n */\n\nimport type { StdOperatorMeta } from '../types.js';\n\n/**\n * String module operators.\n * All operators return strings (or boolean for checks) and have no side effects.\n */\nexport const STR_OPERATORS: Record<string, StdOperatorMeta> = {\n 'str/len': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'String length',\n hasSideEffects: false,\n returnType: 'number',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/len\", \"hello\"] // => 5',\n },\n 'str/upper': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to uppercase',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/upper\", \"hello\"] // => \"HELLO\"',\n },\n 'str/lower': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to lowercase',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/lower\", \"HELLO\"] // => \"hello\"',\n },\n 'str/trim': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Remove leading and trailing whitespace',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/trim\", \" hello \"] // => \"hello\"',\n },\n 'str/trimStart': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Remove leading whitespace',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/trimStart\", \" hello\"] // => \"hello\"',\n },\n 'str/trimEnd': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Remove trailing whitespace',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/trimEnd\", \"hello \"] // => \"hello\"',\n },\n 'str/split': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Split string into array by delimiter',\n hasSideEffects: false,\n returnType: 'array',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'delim', type: 'string', description: 'Delimiter' },\n ],\n example: '[\"str/split\", \"a,b,c\", \",\"] // => [\"a\", \"b\", \"c\"]',\n },\n 'str/join': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Join array elements into string',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'arr', type: 'array', description: 'Array to join' },\n { name: 'delim', type: 'string', description: 'Delimiter' },\n ],\n example: '[\"str/join\", [\"a\", \"b\", \"c\"], \", \"] // => \"a, b, c\"',\n },\n 'str/slice': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 3,\n description: 'Extract substring',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'start', type: 'number', description: 'Start index' },\n { name: 'end', type: 'number', description: 'End index (exclusive)', optional: true },\n ],\n example: '[\"str/slice\", \"hello\", 1, 4] // => \"ell\"',\n },\n 'str/replace': {\n module: 'str',\n category: 'std-str',\n minArity: 3,\n maxArity: 3,\n description: 'Replace first occurrence',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'find', type: 'string', description: 'String to find' },\n { name: 'replace', type: 'string', description: 'Replacement' },\n ],\n example: '[\"str/replace\", \"hello world\", \"world\", \"there\"] // => \"hello there\"',\n },\n 'str/replaceAll': {\n module: 'str',\n category: 'std-str',\n minArity: 3,\n maxArity: 3,\n description: 'Replace all occurrences',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'find', type: 'string', description: 'String to find' },\n { name: 'replace', type: 'string', description: 'Replacement' },\n ],\n example: '[\"str/replaceAll\", \"a-b-c\", \"-\", \"_\"] // => \"a_b_c\"',\n },\n 'str/includes': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Check if string contains substring',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'search', type: 'string', description: 'Substring to find' },\n ],\n example: '[\"str/includes\", \"hello world\", \"world\"] // => true',\n },\n 'str/startsWith': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Check if string starts with prefix',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'prefix', type: 'string', description: 'Prefix to check' },\n ],\n example: '[\"str/startsWith\", \"hello\", \"hel\"] // => true',\n },\n 'str/endsWith': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Check if string ends with suffix',\n hasSideEffects: false,\n returnType: 'boolean',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'suffix', type: 'string', description: 'Suffix to check' },\n ],\n example: '[\"str/endsWith\", \"hello\", \"lo\"] // => true',\n },\n 'str/padStart': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 3,\n description: 'Pad string from start to target length',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'len', type: 'number', description: 'Target length' },\n { name: 'char', type: 'string', description: 'Padding character', optional: true, defaultValue: ' ' },\n ],\n example: '[\"str/padStart\", \"5\", 3, \"0\"] // => \"005\"',\n },\n 'str/padEnd': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 3,\n description: 'Pad string from end to target length',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'len', type: 'number', description: 'Target length' },\n { name: 'char', type: 'string', description: 'Padding character', optional: true, defaultValue: ' ' },\n ],\n example: '[\"str/padEnd\", \"5\", 3, \"0\"] // => \"500\"',\n },\n 'str/repeat': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Repeat string n times',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'count', type: 'number', description: 'Repeat count' },\n ],\n example: '[\"str/repeat\", \"ab\", 3] // => \"ababab\"',\n },\n 'str/reverse': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Reverse string',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/reverse\", \"hello\"] // => \"olleh\"',\n },\n 'str/capitalize': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Capitalize first character',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/capitalize\", \"hello\"] // => \"Hello\"',\n },\n 'str/titleCase': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to Title Case',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/titleCase\", \"hello world\"] // => \"Hello World\"',\n },\n 'str/camelCase': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to camelCase',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/camelCase\", \"hello world\"] // => \"helloWorld\"',\n },\n 'str/kebabCase': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to kebab-case',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/kebabCase\", \"Hello World\"] // => \"hello-world\"',\n },\n 'str/snakeCase': {\n module: 'str',\n category: 'std-str',\n minArity: 1,\n maxArity: 1,\n description: 'Convert to snake_case',\n hasSideEffects: false,\n returnType: 'string',\n params: [{ name: 's', type: 'string', description: 'The string' }],\n example: '[\"str/snakeCase\", \"Hello World\"] // => \"hello_world\"',\n },\n 'str/default': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Return default if value is null/undefined/empty',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string | null', description: 'The value' },\n { name: 'default', type: 'string', description: 'Default value' },\n ],\n example: '[\"str/default\", null, \"N/A\"] // => \"N/A\"',\n },\n 'str/template': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 2,\n description: 'Variable substitution in template string',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 'template', type: 'string', description: 'Template with {placeholders}' },\n { name: 'vars', type: 'object', description: 'Variables to substitute' },\n ],\n example: '[\"str/template\", \"Hello, {name}!\", {\"name\": \"World\"}] // => \"Hello, World!\"',\n },\n 'str/truncate': {\n module: 'str',\n category: 'std-str',\n minArity: 2,\n maxArity: 3,\n description: 'Truncate string with optional suffix',\n hasSideEffects: false,\n returnType: 'string',\n params: [\n { name: 's', type: 'string', description: 'The string' },\n { name: 'len', type: 'number', description: 'Maximum length' },\n { name: 'suffix', type: 'string', description: 'Suffix for truncated strings', optional: true, defaultValue: '...' },\n ],\n example: '[\"str/truncate\", \"Hello World\", 8, \"...\"] // => \"Hello...\"',\n },\n};\n\n/**\n * Get all string operator names.\n */\nexport function getStrOperators(): string[] {\n return Object.keys(STR_OPERATORS);\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tensor Module - Tensor Operations
|
|
5
|
+
*
|
|
6
|
+
* Provides operators for creating and manipulating tensors.
|
|
7
|
+
* Tensors are multi-dimensional arrays used for neural network inputs/outputs.
|
|
8
|
+
* Compiled to native tensor libraries (PyTorch, NumPy, etc.) by the Rust compiler.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Tensor module operators.
|
|
15
|
+
* These operators create and manipulate tensors.
|
|
16
|
+
*/
|
|
17
|
+
declare const TENSOR_OPERATORS: Record<string, StdOperatorMeta>;
|
|
18
|
+
/**
|
|
19
|
+
* Get all tensor operator names.
|
|
20
|
+
*/
|
|
21
|
+
declare function getTensorOperators(): string[];
|
|
22
|
+
|
|
23
|
+
export { TENSOR_OPERATORS, getTensorOperators };
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
// modules/tensor.ts
|
|
2
|
+
var TENSOR_OPERATORS = {
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Creation
|
|
5
|
+
// ============================================================================
|
|
6
|
+
"tensor/from": {
|
|
7
|
+
module: "tensor",
|
|
8
|
+
category: "std-tensor",
|
|
9
|
+
minArity: 1,
|
|
10
|
+
maxArity: 1,
|
|
11
|
+
description: "Create tensor from array",
|
|
12
|
+
hasSideEffects: false,
|
|
13
|
+
returnType: "tensor",
|
|
14
|
+
params: [
|
|
15
|
+
{ name: "data", type: "array", description: "Array of numbers (can be nested for multi-dimensional)" }
|
|
16
|
+
],
|
|
17
|
+
example: '["tensor/from", [1.0, 2.0, 3.0]]'
|
|
18
|
+
},
|
|
19
|
+
"tensor/zeros": {
|
|
20
|
+
module: "tensor",
|
|
21
|
+
category: "std-tensor",
|
|
22
|
+
minArity: 1,
|
|
23
|
+
maxArity: 1,
|
|
24
|
+
description: "Create tensor filled with zeros",
|
|
25
|
+
hasSideEffects: false,
|
|
26
|
+
returnType: "tensor",
|
|
27
|
+
params: [
|
|
28
|
+
{ name: "shape", type: "number[]", description: "Shape of the tensor" }
|
|
29
|
+
],
|
|
30
|
+
example: '["tensor/zeros", [3, 4]] // 3x4 tensor of zeros'
|
|
31
|
+
},
|
|
32
|
+
"tensor/ones": {
|
|
33
|
+
module: "tensor",
|
|
34
|
+
category: "std-tensor",
|
|
35
|
+
minArity: 1,
|
|
36
|
+
maxArity: 1,
|
|
37
|
+
description: "Create tensor filled with ones",
|
|
38
|
+
hasSideEffects: false,
|
|
39
|
+
returnType: "tensor",
|
|
40
|
+
params: [
|
|
41
|
+
{ name: "shape", type: "number[]", description: "Shape of the tensor" }
|
|
42
|
+
],
|
|
43
|
+
example: '["tensor/ones", [3, 4]] // 3x4 tensor of ones'
|
|
44
|
+
},
|
|
45
|
+
"tensor/rand": {
|
|
46
|
+
module: "tensor",
|
|
47
|
+
category: "std-tensor",
|
|
48
|
+
minArity: 1,
|
|
49
|
+
maxArity: 1,
|
|
50
|
+
description: "Create tensor with random values in [0, 1)",
|
|
51
|
+
hasSideEffects: false,
|
|
52
|
+
returnType: "tensor",
|
|
53
|
+
params: [
|
|
54
|
+
{ name: "shape", type: "number[]", description: "Shape of the tensor" }
|
|
55
|
+
],
|
|
56
|
+
example: '["tensor/rand", [16]] // Random 16-element vector'
|
|
57
|
+
},
|
|
58
|
+
"tensor/randn": {
|
|
59
|
+
module: "tensor",
|
|
60
|
+
category: "std-tensor",
|
|
61
|
+
minArity: 1,
|
|
62
|
+
maxArity: 1,
|
|
63
|
+
description: "Create tensor with random values from standard normal distribution",
|
|
64
|
+
hasSideEffects: false,
|
|
65
|
+
returnType: "tensor",
|
|
66
|
+
params: [
|
|
67
|
+
{ name: "shape", type: "number[]", description: "Shape of the tensor" }
|
|
68
|
+
],
|
|
69
|
+
example: '["tensor/randn", [16]] // Random normal 16-element vector'
|
|
70
|
+
},
|
|
71
|
+
// ============================================================================
|
|
72
|
+
// Shape & Indexing
|
|
73
|
+
// ============================================================================
|
|
74
|
+
"tensor/shape": {
|
|
75
|
+
module: "tensor",
|
|
76
|
+
category: "std-tensor",
|
|
77
|
+
minArity: 1,
|
|
78
|
+
maxArity: 1,
|
|
79
|
+
description: "Get tensor shape as array",
|
|
80
|
+
hasSideEffects: false,
|
|
81
|
+
returnType: "number[]",
|
|
82
|
+
params: [
|
|
83
|
+
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
84
|
+
],
|
|
85
|
+
example: '["tensor/shape", "@entity.sensors"] // => [16]'
|
|
86
|
+
},
|
|
87
|
+
"tensor/get": {
|
|
88
|
+
module: "tensor",
|
|
89
|
+
category: "std-tensor",
|
|
90
|
+
minArity: 2,
|
|
91
|
+
maxArity: 2,
|
|
92
|
+
description: "Get element at index",
|
|
93
|
+
hasSideEffects: false,
|
|
94
|
+
returnType: "number",
|
|
95
|
+
params: [
|
|
96
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
97
|
+
{ name: "index", type: "number | number[]", description: "Index (single for 1D, array for multi-D)" }
|
|
98
|
+
],
|
|
99
|
+
example: '["tensor/get", "@entity.output", 3] // Get 4th element'
|
|
100
|
+
},
|
|
101
|
+
"tensor/slice": {
|
|
102
|
+
module: "tensor",
|
|
103
|
+
category: "std-tensor",
|
|
104
|
+
minArity: 3,
|
|
105
|
+
maxArity: 3,
|
|
106
|
+
description: "Get slice of tensor",
|
|
107
|
+
hasSideEffects: false,
|
|
108
|
+
returnType: "tensor",
|
|
109
|
+
params: [
|
|
110
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
111
|
+
{ name: "start", type: "number", description: "Start index" },
|
|
112
|
+
{ name: "end", type: "number", description: "End index (exclusive)" }
|
|
113
|
+
],
|
|
114
|
+
example: '["tensor/slice", "@entity.output", 0, 3] // First 3 elements'
|
|
115
|
+
},
|
|
116
|
+
"tensor/reshape": {
|
|
117
|
+
module: "tensor",
|
|
118
|
+
category: "std-tensor",
|
|
119
|
+
minArity: 2,
|
|
120
|
+
maxArity: 2,
|
|
121
|
+
description: "Reshape tensor to new shape (total elements must match)",
|
|
122
|
+
hasSideEffects: false,
|
|
123
|
+
returnType: "tensor",
|
|
124
|
+
params: [
|
|
125
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
126
|
+
{ name: "shape", type: "number[]", description: "New shape" }
|
|
127
|
+
],
|
|
128
|
+
example: '["tensor/reshape", "@entity.data", [4, 4]] // Reshape to 4x4'
|
|
129
|
+
},
|
|
130
|
+
"tensor/flatten": {
|
|
131
|
+
module: "tensor",
|
|
132
|
+
category: "std-tensor",
|
|
133
|
+
minArity: 1,
|
|
134
|
+
maxArity: 1,
|
|
135
|
+
description: "Flatten tensor to 1D",
|
|
136
|
+
hasSideEffects: false,
|
|
137
|
+
returnType: "tensor",
|
|
138
|
+
params: [
|
|
139
|
+
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
140
|
+
],
|
|
141
|
+
example: '["tensor/flatten", "@entity.data"]'
|
|
142
|
+
},
|
|
143
|
+
// ============================================================================
|
|
144
|
+
// Math Operations
|
|
145
|
+
// ============================================================================
|
|
146
|
+
"tensor/add": {
|
|
147
|
+
module: "tensor",
|
|
148
|
+
category: "std-tensor",
|
|
149
|
+
minArity: 2,
|
|
150
|
+
maxArity: 2,
|
|
151
|
+
description: "Element-wise addition",
|
|
152
|
+
hasSideEffects: false,
|
|
153
|
+
returnType: "tensor",
|
|
154
|
+
params: [
|
|
155
|
+
{ name: "a", type: "tensor", description: "First tensor" },
|
|
156
|
+
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
157
|
+
],
|
|
158
|
+
example: '["tensor/add", "@entity.a", "@entity.b"]'
|
|
159
|
+
},
|
|
160
|
+
"tensor/sub": {
|
|
161
|
+
module: "tensor",
|
|
162
|
+
category: "std-tensor",
|
|
163
|
+
minArity: 2,
|
|
164
|
+
maxArity: 2,
|
|
165
|
+
description: "Element-wise subtraction",
|
|
166
|
+
hasSideEffects: false,
|
|
167
|
+
returnType: "tensor",
|
|
168
|
+
params: [
|
|
169
|
+
{ name: "a", type: "tensor", description: "First tensor" },
|
|
170
|
+
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
171
|
+
],
|
|
172
|
+
example: '["tensor/sub", "@entity.a", "@entity.b"]'
|
|
173
|
+
},
|
|
174
|
+
"tensor/mul": {
|
|
175
|
+
module: "tensor",
|
|
176
|
+
category: "std-tensor",
|
|
177
|
+
minArity: 2,
|
|
178
|
+
maxArity: 2,
|
|
179
|
+
description: "Element-wise multiplication",
|
|
180
|
+
hasSideEffects: false,
|
|
181
|
+
returnType: "tensor",
|
|
182
|
+
params: [
|
|
183
|
+
{ name: "a", type: "tensor", description: "First tensor" },
|
|
184
|
+
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
185
|
+
],
|
|
186
|
+
example: '["tensor/mul", "@entity.weights", 0.99] // Decay weights'
|
|
187
|
+
},
|
|
188
|
+
"tensor/div": {
|
|
189
|
+
module: "tensor",
|
|
190
|
+
category: "std-tensor",
|
|
191
|
+
minArity: 2,
|
|
192
|
+
maxArity: 2,
|
|
193
|
+
description: "Element-wise division",
|
|
194
|
+
hasSideEffects: false,
|
|
195
|
+
returnType: "tensor",
|
|
196
|
+
params: [
|
|
197
|
+
{ name: "a", type: "tensor", description: "First tensor" },
|
|
198
|
+
{ name: "b", type: "tensor | number", description: "Second tensor or scalar" }
|
|
199
|
+
],
|
|
200
|
+
example: '["tensor/div", "@entity.gradient", "@entity.batchSize"]'
|
|
201
|
+
},
|
|
202
|
+
"tensor/matmul": {
|
|
203
|
+
module: "tensor",
|
|
204
|
+
category: "std-tensor",
|
|
205
|
+
minArity: 2,
|
|
206
|
+
maxArity: 2,
|
|
207
|
+
description: "Matrix multiplication",
|
|
208
|
+
hasSideEffects: false,
|
|
209
|
+
returnType: "tensor",
|
|
210
|
+
params: [
|
|
211
|
+
{ name: "a", type: "tensor", description: "First tensor (NxM)" },
|
|
212
|
+
{ name: "b", type: "tensor", description: "Second tensor (MxK)" }
|
|
213
|
+
],
|
|
214
|
+
example: '["tensor/matmul", "@entity.input", "@entity.weights"]'
|
|
215
|
+
},
|
|
216
|
+
"tensor/dot": {
|
|
217
|
+
module: "tensor",
|
|
218
|
+
category: "std-tensor",
|
|
219
|
+
minArity: 2,
|
|
220
|
+
maxArity: 2,
|
|
221
|
+
description: "Dot product of two 1D tensors",
|
|
222
|
+
hasSideEffects: false,
|
|
223
|
+
returnType: "number",
|
|
224
|
+
params: [
|
|
225
|
+
{ name: "a", type: "tensor", description: "First vector" },
|
|
226
|
+
{ name: "b", type: "tensor", description: "Second vector" }
|
|
227
|
+
],
|
|
228
|
+
example: '["tensor/dot", "@entity.a", "@entity.b"]'
|
|
229
|
+
},
|
|
230
|
+
// ============================================================================
|
|
231
|
+
// Reductions
|
|
232
|
+
// ============================================================================
|
|
233
|
+
"tensor/sum": {
|
|
234
|
+
module: "tensor",
|
|
235
|
+
category: "std-tensor",
|
|
236
|
+
minArity: 1,
|
|
237
|
+
maxArity: 2,
|
|
238
|
+
description: "Sum of tensor elements",
|
|
239
|
+
hasSideEffects: false,
|
|
240
|
+
returnType: "number | tensor",
|
|
241
|
+
params: [
|
|
242
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
243
|
+
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
244
|
+
],
|
|
245
|
+
example: '["tensor/sum", "@entity.rewards"] // Total reward'
|
|
246
|
+
},
|
|
247
|
+
"tensor/mean": {
|
|
248
|
+
module: "tensor",
|
|
249
|
+
category: "std-tensor",
|
|
250
|
+
minArity: 1,
|
|
251
|
+
maxArity: 2,
|
|
252
|
+
description: "Mean of tensor elements",
|
|
253
|
+
hasSideEffects: false,
|
|
254
|
+
returnType: "number | tensor",
|
|
255
|
+
params: [
|
|
256
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
257
|
+
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
258
|
+
],
|
|
259
|
+
example: '["tensor/mean", "@entity.losses"]'
|
|
260
|
+
},
|
|
261
|
+
"tensor/max": {
|
|
262
|
+
module: "tensor",
|
|
263
|
+
category: "std-tensor",
|
|
264
|
+
minArity: 1,
|
|
265
|
+
maxArity: 2,
|
|
266
|
+
description: "Maximum value in tensor",
|
|
267
|
+
hasSideEffects: false,
|
|
268
|
+
returnType: "number | tensor",
|
|
269
|
+
params: [
|
|
270
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
271
|
+
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
272
|
+
],
|
|
273
|
+
example: '["tensor/max", "@entity.qValues"]'
|
|
274
|
+
},
|
|
275
|
+
"tensor/min": {
|
|
276
|
+
module: "tensor",
|
|
277
|
+
category: "std-tensor",
|
|
278
|
+
minArity: 1,
|
|
279
|
+
maxArity: 2,
|
|
280
|
+
description: "Minimum value in tensor",
|
|
281
|
+
hasSideEffects: false,
|
|
282
|
+
returnType: "number | tensor",
|
|
283
|
+
params: [
|
|
284
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
285
|
+
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
286
|
+
],
|
|
287
|
+
example: '["tensor/min", "@entity.distances"]'
|
|
288
|
+
},
|
|
289
|
+
"tensor/argmax": {
|
|
290
|
+
module: "tensor",
|
|
291
|
+
category: "std-tensor",
|
|
292
|
+
minArity: 1,
|
|
293
|
+
maxArity: 2,
|
|
294
|
+
description: "Index of maximum value",
|
|
295
|
+
hasSideEffects: false,
|
|
296
|
+
returnType: "number | tensor",
|
|
297
|
+
params: [
|
|
298
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
299
|
+
{ name: "dim", type: "number", description: "Dimension to reduce", optional: true }
|
|
300
|
+
],
|
|
301
|
+
example: '["tensor/argmax", "@entity.qValues"] // Best action index'
|
|
302
|
+
},
|
|
303
|
+
"tensor/norm": {
|
|
304
|
+
module: "tensor",
|
|
305
|
+
category: "std-tensor",
|
|
306
|
+
minArity: 1,
|
|
307
|
+
maxArity: 2,
|
|
308
|
+
description: "L2 norm of tensor",
|
|
309
|
+
hasSideEffects: false,
|
|
310
|
+
returnType: "number",
|
|
311
|
+
params: [
|
|
312
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
313
|
+
{ name: "p", type: "number", description: "Norm order (default 2)", optional: true, defaultValue: 2 }
|
|
314
|
+
],
|
|
315
|
+
example: '["tensor/norm", "@entity.gradient"]'
|
|
316
|
+
},
|
|
317
|
+
// ============================================================================
|
|
318
|
+
// Range Validation (for contracts)
|
|
319
|
+
// ============================================================================
|
|
320
|
+
"tensor/allInRange": {
|
|
321
|
+
module: "tensor",
|
|
322
|
+
category: "std-tensor",
|
|
323
|
+
minArity: 2,
|
|
324
|
+
maxArity: 2,
|
|
325
|
+
description: "Check if all elements are within range [min, max]",
|
|
326
|
+
hasSideEffects: false,
|
|
327
|
+
returnType: "boolean",
|
|
328
|
+
params: [
|
|
329
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
330
|
+
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
331
|
+
],
|
|
332
|
+
example: '["tensor/allInRange", "@payload.input", [-1.0, 1.0]]'
|
|
333
|
+
},
|
|
334
|
+
"tensor/outOfRangeIndices": {
|
|
335
|
+
module: "tensor",
|
|
336
|
+
category: "std-tensor",
|
|
337
|
+
minArity: 2,
|
|
338
|
+
maxArity: 2,
|
|
339
|
+
description: "Get indices of elements outside range",
|
|
340
|
+
hasSideEffects: false,
|
|
341
|
+
returnType: "number[]",
|
|
342
|
+
params: [
|
|
343
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
344
|
+
{ name: "range", type: "[number, number]", description: "Range as [min, max]" }
|
|
345
|
+
],
|
|
346
|
+
example: '["tensor/outOfRangeIndices", "@payload.input", [-1.0, 1.0]]'
|
|
347
|
+
},
|
|
348
|
+
"tensor/clamp": {
|
|
349
|
+
module: "tensor",
|
|
350
|
+
category: "std-tensor",
|
|
351
|
+
minArity: 3,
|
|
352
|
+
maxArity: 3,
|
|
353
|
+
description: "Clamp all elements to range [min, max]",
|
|
354
|
+
hasSideEffects: false,
|
|
355
|
+
returnType: "tensor",
|
|
356
|
+
params: [
|
|
357
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
358
|
+
{ name: "min", type: "number", description: "Minimum value" },
|
|
359
|
+
{ name: "max", type: "number", description: "Maximum value" }
|
|
360
|
+
],
|
|
361
|
+
example: '["tensor/clamp", "@entity.output", -10.0, 10.0]'
|
|
362
|
+
},
|
|
363
|
+
"tensor/clampPerDim": {
|
|
364
|
+
module: "tensor",
|
|
365
|
+
category: "std-tensor",
|
|
366
|
+
minArity: 2,
|
|
367
|
+
maxArity: 2,
|
|
368
|
+
description: "Clamp each dimension to its specified range",
|
|
369
|
+
hasSideEffects: false,
|
|
370
|
+
returnType: "tensor",
|
|
371
|
+
params: [
|
|
372
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
373
|
+
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
374
|
+
],
|
|
375
|
+
example: '["tensor/clampPerDim", "@entity.rawOutput", "@entity.outputContract.ranges"]'
|
|
376
|
+
},
|
|
377
|
+
"tensor/outOfRangeDims": {
|
|
378
|
+
module: "tensor",
|
|
379
|
+
category: "std-tensor",
|
|
380
|
+
minArity: 2,
|
|
381
|
+
maxArity: 2,
|
|
382
|
+
description: "Get dimensions that exceed their specified ranges",
|
|
383
|
+
hasSideEffects: false,
|
|
384
|
+
returnType: "array",
|
|
385
|
+
params: [
|
|
386
|
+
{ name: "tensor", type: "tensor", description: "The tensor" },
|
|
387
|
+
{ name: "ranges", type: "object", description: 'Per-dimension ranges { "0": {min, max}, ... }' }
|
|
388
|
+
],
|
|
389
|
+
example: '["tensor/outOfRangeDims", "@entity.rawOutput", "@entity.outputContract.ranges"]'
|
|
390
|
+
},
|
|
391
|
+
// ============================================================================
|
|
392
|
+
// Conversion
|
|
393
|
+
// ============================================================================
|
|
394
|
+
"tensor/toArray": {
|
|
395
|
+
module: "tensor",
|
|
396
|
+
category: "std-tensor",
|
|
397
|
+
minArity: 1,
|
|
398
|
+
maxArity: 1,
|
|
399
|
+
description: "Convert tensor to nested array",
|
|
400
|
+
hasSideEffects: false,
|
|
401
|
+
returnType: "array",
|
|
402
|
+
params: [
|
|
403
|
+
{ name: "tensor", type: "tensor", description: "The tensor" }
|
|
404
|
+
],
|
|
405
|
+
example: '["tensor/toArray", "@entity.output"]'
|
|
406
|
+
},
|
|
407
|
+
"tensor/toList": {
|
|
408
|
+
module: "tensor",
|
|
409
|
+
category: "std-tensor",
|
|
410
|
+
minArity: 1,
|
|
411
|
+
maxArity: 1,
|
|
412
|
+
description: "Convert 1D tensor to flat array",
|
|
413
|
+
hasSideEffects: false,
|
|
414
|
+
returnType: "number[]",
|
|
415
|
+
params: [
|
|
416
|
+
{ name: "tensor", type: "tensor", description: "The tensor (must be 1D)" }
|
|
417
|
+
],
|
|
418
|
+
example: '["tensor/toList", "@entity.output"]'
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
function getTensorOperators() {
|
|
422
|
+
return Object.keys(TENSOR_OPERATORS);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export { TENSOR_OPERATORS, getTensorOperators };
|
|
426
|
+
//# sourceMappingURL=tensor.js.map
|
|
427
|
+
//# sourceMappingURL=tensor.js.map
|
|
@@ -0,0 +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,E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ACX;AAAA;AAAA;AAAA;AAAA,EAMA,gBAAA,EAAkB;AAAA,IAChB,MAAA,EAAQ,QAAA;AAAA,IACR,QAAA,EAAU,YAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,QAAA,EAAU,CAAA;AAAA,IACV,WAAA,EAAa,gCAAA;AAAA,IACb,cAAA,EAAgB,KAAA;AAAA,IAChB,UAAA,EAAY,OAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,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"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { a as StdOperatorMeta } from '../types-I95R8_FN.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Time Module - Date and Time Operations
|
|
5
|
+
*
|
|
6
|
+
* Provides date manipulation, formatting, and comparison functions.
|
|
7
|
+
*
|
|
8
|
+
* Time units: 'year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'ms'
|
|
9
|
+
* Format tokens: 'YYYY', 'MM', 'DD', 'HH', 'mm', 'ss', 'ddd', 'MMM'
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Time module operators.
|
|
16
|
+
* All operators work with dates/timestamps and have no side effects.
|
|
17
|
+
*/
|
|
18
|
+
declare const TIME_OPERATORS: Record<string, StdOperatorMeta>;
|
|
19
|
+
/**
|
|
20
|
+
* Get all time operator names.
|
|
21
|
+
*/
|
|
22
|
+
declare function getTimeOperators(): string[];
|
|
23
|
+
|
|
24
|
+
export { TIME_OPERATORS, getTimeOperators };
|