Class FunctionalTensor
Represents a tensor that is a result of functional tensor operations.
Inherited Members
Namespace: Unity.InferenceEngine
Assembly: Unity.InferenceEngine.dll
Syntax
[MovedFrom("Unity.Sentis")]
public class FunctionalTensor
Remarks
A FunctionalTensor represents a tensor node in a FunctionalGraph.
Unlike a Tensor, which contains actual data, a FunctionalTensor represents the result of operations that will be executed later when the graph is compiled and run.
Use FunctionalTensor objects to build computation graphs using the Functional API.
The tensor may have a partially known shape where some dimensions are dynamic (unknown at graph construction time).
Chain operations together using methods from the Functional class, or operators defined on FunctionalTensor.
FunctionalTensor supports standard arithmetic operators, comparison operators, and indexing,
making it convenient to express complex tensor computations using familiar syntax.
Examples
Create and manipulate FunctionalTensor objects
// Create functional tensors
var tensor1 = Functional.Constant(new TensorShape(new[] {2, 2}), new[] { 1.0f, 2.0f, 3.0f, 4.0f });
// tensor1 is a functional tensor of shape [2, 2], of data type float, with values [[1.0, 2.0], [3.0, 4.0]].
var tensor2 = tensor1 + 0.1f;
// tensor2 is a functional tensor of shape [2, 2], of data type float, with values [[1.1, 2.1], [3.1, 4.1]].
See also [Workflow Example](xref:sentis-workflow-example).
Properties
this[Index, Index, Index, Range]
Gets or sets a subset of the tensor using indices for the first three dimensions and a range for the fourth dimension.
Declaration
public FunctionalTensor this[Index i0, Index i1, Index i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0, 1, and 2, and a range along dimension 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for the first three dimensions and a range for the fourth
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 1, 1, 1..3]; // Shape: [2]
// Result: [18, 19] (elements at [0,1,1,1:3])
this[Index, Index, Range]
Gets or sets a subset of the tensor using indices for the first two dimensions and a range for the third dimension.
Declaration
public FunctionalTensor this[Index i0, Index i1, Range i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0 and 1, and a range along dimension 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for the first two dimensions and a range for the third
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0, 1, 1..3]; // Shape: [2]
// Result: [6, 7] (elements at [0,1,1] and [0,1,2])
this[Index, Index, Range, Index]
Gets or sets a subset of the tensor using indices for dimensions 0, 1, and 3, and a range for dimension 2.
Declaration
public FunctionalTensor this[Index i0, Index i1, Range i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0, 1, and 3, and a range along dimension 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for dimensions 0, 1, and 3, and a range for dimension 2
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 1, 1..3, 2]; // Shape: [2]
// Result: [19, 23] (elements at [0,1,1:3,2])
this[Index, Index, Range, Range]
Gets or sets a subset of the tensor using indices for the first two dimensions and ranges for the last two dimensions.
Declaration
public FunctionalTensor this[Index i0, Index i1, Range i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0 and 1, and ranges along dimensions 2 and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for the first two dimensions and ranges for the last two
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 1, 1..3, 1..3]; // Shape: [2, 2]
// Result: [[18, 19], [22, 23]] (elements at [0,1,1:3,1:3])
this[Index, Range]
Gets or sets a subset of the tensor using a specific index for the first dimension and a range for the second dimension.
Declaration
public FunctionalTensor this[Index i0, Range i1] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer combines index and range syntax for flexible tensor slicing.
Supports negative indexing using ^ notation for both indices and range endpoints.
Examples
Access tensor using an index for the first dimension and a range for the second
var tensor = Functional.Constant(new TensorShape(3, 4), new[] {
1f, 2f, 3f, 4f,
5f, 6f, 7f, 8f,
9f, 10f, 11f, 12f
});
// Get first row, columns 1 to 3 - Shape: [2]
var result = tensor[0, 1..3];
// Result: [2, 3]
// Get last row, all columns - Shape: [4]
var lastRow = tensor[^1, ..];
// Result: [9, 10, 11, 12]
this[Index, Range, Index]
Gets or sets a subset of the tensor using an index for dimensions 0 and 2, and a range for dimension 1.
Declaration
public FunctionalTensor this[Index i0, Range i1, Index i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0 and 2, and a range along dimension 1.
Supports negative indexing using ^ notation.
Examples
Access tensor using an index for dimensions 0 and 2, and a range for dimension 1
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0, 1..3, 2]; // Shape: [2]
// Result: [7, 11] (elements at [0,1,2] and [0,2,2])
this[Index, Range, Index, Index]
Gets or sets a subset of the tensor using an index for dimension 0, a range for dimension 1, and indices for dimensions 2 and 3.
Declaration
public FunctionalTensor this[Index i0, Range i1, Index i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects a specific element along dimensions 0, 2, and 3, and a range along dimension 1.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for dimensions 0, 2, and 3, and a range for dimension 1
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 0..2, 1, 2]; // Shape: [2]
// Result: [7, 19] (elements at [0,0:2,1,2])
this[Index, Range, Index, Range]
Gets or sets a subset of the tensor using an index for dimensions 0 and 2, and ranges for dimensions 1 and 3.
Declaration
public FunctionalTensor this[Index i0, Range i1, Index i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0 and 2, and ranges along dimensions 1 and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for dimensions 0 and 2, and ranges for dimensions 1 and 3
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 0..2, 1, 1..3]; // Shape: [2, 2]
// Result: [[6, 7], [18, 19]] (elements at [0,0:2,1,1:3])
this[Index, Range, Range]
Gets or sets a subset of the tensor using an index for the first dimension and ranges for the second and third dimensions.
Declaration
public FunctionalTensor this[Index i0, Range i1, Range i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects a specific element along dimension 0, and ranges along dimensions 1 and 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using an index for the first dimension and ranges for the second and third
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0, 1..3, 1..3]; // Shape: [2, 2]
// Result: [[6, 7], [10, 11]] (elements at [0,1:3,1:3])
this[Index, Range, Range, Index]
Gets or sets a subset of the tensor using an index for dimensions 0 and 3, and ranges for dimensions 1 and 2.
Declaration
public FunctionalTensor this[Index i0, Range i1, Range i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects specific elements along dimensions 0 and 3, and ranges along dimensions 1 and 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using indices for dimensions 0 and 3, and ranges for dimensions 1 and 2
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 0..2, 1..3, 2]; // Shape: [2, 2]
// Result: [[7, 11], [19, 23]] (elements at [0,0:2,1:3,2])
this[Index, Range, Range, Range]
Gets or sets a subset of the tensor using an index for the first dimension and ranges for the last three dimensions.
Declaration
public FunctionalTensor this[Index i0, Range i1, Range i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index | i0 | The Index position for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects a specific element along dimension 0, and ranges along dimensions 1, 2, and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using an index for the first dimension and ranges for the last three
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0, 0..2, 1..3, 1..3]; // Shape: [2, 2, 2]
// Result: [[[6, 7], [10, 11]], [[18, 19], [22, 23]]] (elements at [0,0:2,1:3,1:3])
this[Index[]]
Gets or sets a subset of the tensor using index positions.
Declaration
public FunctionalTensor this[params Index[] indices] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Index[] | indices | The Index positions for each dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer retrieves or assigns values at specific positions in the tensor using Index syntax.
Each index specifies a single position along the corresponding dimension.
Supports negative indexing using ^ notation to count from the end (for example, ^1 refers to the last element).
Examples
Access and modify tensor elements using index positions
var tensor = Functional.Constant(new TensorShape(3, 4), new[] {
1f, 2f, 3f, 4f,
5f, 6f, 7f, 8f,
9f, 10f, 11f, 12f
});
// Get element at position [1, 2]
var element = tensor[1, 2]; // Shape: [] (scalar), value: 7
// Get row using negative index - ^1 means last row
var lastRow = tensor[^1, ..]; // Shape: [4], values: [9, 10, 11, 12]
// Set first element to 99
tensor[0, 0] = Functional.Constant(99f);
// Result: [[99, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
this[Range, Index]
Gets or sets a subset of the tensor using a range for the first dimension and a specific index for the second dimension.
Declaration
public FunctionalTensor this[Range i0, Index i1] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer combines range and index syntax for flexible tensor slicing.
Supports negative indexing using ^ notation for both range endpoints and indices.
Examples
Access tensor using a range for the first dimension and an index for the second
var tensor = Functional.Constant(new TensorShape(3, 4), new[] {
1f, 2f, 3f, 4f,
5f, 6f, 7f, 8f,
9f, 10f, 11f, 12f
});
// Get first two rows, second column - Shape: [2]
var result = tensor[0..2, 1];
// Result: [2, 6]
// Get all rows, last column - Shape: [3]
var lastCol = tensor[.., ^1];
// Result: [4, 8, 12]
this[Range, Index, Index]
Gets or sets a subset of the tensor using a range for the first dimension and indices for the second and third dimensions.
Declaration
public FunctionalTensor this[Range i0, Index i1, Index i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects a range along dimension 0, and specific elements along dimensions 1 and 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using a range for the first dimension and indices for the second and third
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0..2, 1, 2]; // Shape: [2]
// Result: [7, 19] (elements at [0,1,2] and [1,1,2])
this[Range, Index, Index, Index]
Gets or sets a subset of the tensor using a range for the first dimension and indices for the last three dimensions.
Declaration
public FunctionalTensor this[Range i0, Index i1, Index i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects a range along dimension 0, and specific elements along dimensions 1, 2, and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using a range for the first dimension and indices for the last three
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 1, 1, 2]; // Shape: [2]
// Result: [19, 43] (elements at [0:2,1,1,2])
this[Range, Index, Index, Range]
Gets or sets a subset of the tensor using ranges for dimensions 0 and 3, and indices for dimensions 1 and 2.
Declaration
public FunctionalTensor this[Range i0, Index i1, Index i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0 and 3, and specific elements along dimensions 1 and 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for dimensions 0 and 3, and indices for dimensions 1 and 2
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 1, 1, 1..3]; // Shape: [2, 2]
// Result: [[18, 19], [42, 43]] (elements at [0:2,1,1,1:3])
this[Range, Index, Range]
Gets or sets a subset of the tensor using ranges for dimensions 0 and 2, and an index for dimension 1.
Declaration
public FunctionalTensor this[Range i0, Index i1, Range i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0 and 2, and a specific element along dimension 1.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for dimensions 0 and 2, and an index for dimension 1
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0..2, 1, 1..3]; // Shape: [2, 2]
// Result: [[6, 7], [18, 19]] (elements at [0:2,1,1:3])
this[Range, Index, Range, Index]
Gets or sets a subset of the tensor using ranges for dimensions 0 and 2, and indices for dimensions 1 and 3.
Declaration
public FunctionalTensor this[Range i0, Index i1, Range i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0 and 2, and specific elements along dimensions 1 and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for dimensions 0 and 2, and indices for dimensions 1 and 3
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 1, 1..3, 2]; // Shape: [2, 2]
// Result: [[19, 23], [43, 47]] (elements at [0:2,1,1:3,2])
this[Range, Index, Range, Range]
Gets or sets a subset of the tensor using ranges for dimensions 0, 2, and 3, and an index for dimension 1.
Declaration
public FunctionalTensor this[Range i0, Index i1, Range i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Index | i1 | The Index position for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0, 2, and 3, and a specific element along dimension 1.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for dimensions 0, 2, and 3, and an index for dimension 1
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 1, 1..3, 1..3]; // Shape: [2, 2, 2]
// Result: [[[18, 19], [22, 23]], [[42, 43], [46, 47]]] (elements at [0:2,1,1:3,1:3])
this[Range, Range, Index]
Gets or sets a subset of the tensor using ranges for the first two dimensions and an index for the third dimension.
Declaration
public FunctionalTensor this[Range i0, Range i1, Index i2] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0 and 1, and a specific element along dimension 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for the first two dimensions and an index for the third
var tensor = Functional.Constant(new TensorShape(2, 3, 4), new[] {
1f, 2f, 3f, 4f, // [0,0,:]
5f, 6f, 7f, 8f, // [0,1,:]
9f, 10f, 11f, 12f, // [0,2,:]
13f, 14f, 15f, 16f, // [1,0,:]
17f, 18f, 19f, 20f, // [1,1,:]
21f, 22f, 23f, 24f // [1,2,:]
});
var slice = tensor[0..2, 1..3, 2]; // Shape: [2, 2]
// Result: [[7, 11], [19, 23]] (elements at [0:2,1:3,2])
this[Range, Range, Index, Index]
Gets or sets a subset of the tensor using ranges for the first two dimensions and indices for the last two dimensions.
Declaration
public FunctionalTensor this[Range i0, Range i1, Index i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0 and 1, and specific elements along dimensions 2 and 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for the first two dimensions and indices for the last two
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 0..2, 1, 2]; // Shape: [2, 2]
// Result: [[7, 19], [31, 43]] (elements at [0:2,0:2,1,2])
this[Range, Range, Index, Range]
Gets or sets a subset of the tensor using ranges for dimensions 0, 1, and 3, and an index for dimension 2.
Declaration
public FunctionalTensor this[Range i0, Range i1, Index i2, Range i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Index | i2 | The Index position for the third dimension. |
| Range | i3 | The Range slice for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0, 1, and 3, and a specific element along dimension 2.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for dimensions 0, 1, and 3, and an index for dimension 2
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 0..2, 1, 1..3]; // Shape: [2, 2, 2]
// Result: [[[6, 7], [18, 19]], [[30, 31], [42, 43]]] (elements at [0:2,0:2,1,1:3])
this[Range, Range, Range, Index]
Gets or sets a subset of the tensor using ranges for the first three dimensions and an index for the fourth dimension.
Declaration
public FunctionalTensor this[Range i0, Range i1, Range i2, Index i3] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range | i0 | The Range slice for the first dimension. |
| Range | i1 | The Range slice for the second dimension. |
| Range | i2 | The Range slice for the third dimension. |
| Index | i3 | The Index position for the fourth dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the indexed subset. |
Remarks
This indexer selects ranges along dimensions 0, 1, and 2, and a specific element along dimension 3.
Supports negative indexing using ^ notation.
Examples
Access tensor using ranges for the first three dimensions and an index for the fourth
var tensor = Functional.Constant(new TensorShape(2, 2, 3, 4), new[] {
1f, 2f, 3f, 4f, 5f, 6f, 7f, 8f, 9f, 10f, 11f, 12f, // [0,0,:,:]
13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, // [0,1,:,:]
25f, 26f, 27f, 28f, 29f, 30f, 31f, 32f, 33f, 34f, 35f, 36f, // [1,0,:,:]
37f, 38f, 39f, 40f, 41f, 42f, 43f, 44f, 45f, 46f, 47f, 48f // [1,1,:,:]
});
var slice = tensor[0..2, 0..2, 1..3, 2]; // Shape: [2, 2, 2]
// Result: [[[7, 11], [19, 23]], [[31, 35], [43, 47]]] (elements at [0:2,0:2,1:3,2])
this[Range[]]
Gets or sets a subset of the tensor using range slices.
Declaration
public FunctionalTensor this[params Range[] ranges] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| Range[] | ranges | The Ranges for slicing each dimension. |
Property Value
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the sliced subset. |
Remarks
This indexer retrieves or assigns values from continuous ranges along each dimension using Range syntax.
Each range selects a slice of elements along the corresponding dimension.
Supports the .. operator for selecting all elements in a dimension, and range endpoints can use negative indexing with ^.
Examples
Access and modify tensor elements using ranges
var tensor = Functional.Constant(new TensorShape(3, 4), new[] {
1f, 2f, 3f, 4f,
5f, 6f, 7f, 8f,
9f, 10f, 11f, 12f
});
// Get first two rows, all columns - Shape: [2, 4]
var subset = tensor[0..2, ..];
// Result: [[1, 2, 3, 4], [5, 6, 7, 8]]
// Get middle section using ranges - Shape: [2, 2]
var middle = tensor[1..3, 1..3];
// Result: [[6, 7], [10, 11]]
// Use negative indexing - last 2 rows, first 3 columns
var bottomLeft = tensor[^2.., ..3]; // Shape: [2, 3]
// Result: [[5, 6, 7], [9, 10, 11]]
// Set a slice
var newValues = Functional.Constant(new TensorShape(1, 4), new[] { 99f, 98f, 97f, 96f });
tensor[0..1, ..] = newValues;
// Result: [[99, 98, 97, 96], [5, 6, 7, 8], [9, 10, 11, 12]]
Methods
ToString()
Returns a string representation of the functional tensor with its data type and shape.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | A string representation of the functional tensor. |
Overrides
Remarks
This method provides a human-readable representation of the tensor.
If the shape is fully known (static), it displays the complete shape.
If the shape contains dynamic (unknown) dimensions, it displays (?).
Examples
Get a string representation of a FunctionalTensor
var tensor = Functional.Constant(new TensorShape(new[] { 2, 3 }), new[] { 2, 3, 4, 6, 7, 8 });
tensor.ToString(); // Returns "Int(2, 3)"
var graph = new FunctionalGraph();
var input = graph.AddInput(DataType.Float, new DynamicTensorShape(-1, 4, 24));
input.ToString(); // Returns "Float(?)"
Operators
operator +(int, FunctionalTensor)
Addition operator.
Declaration
public static FunctionalTensor operator +(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to add. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value added to each element. |
Remarks
This operator adds a constant integer value to every element in the tensor. This overload supports commutative addition (scalar + tensor = tensor + scalar).
operator +(float, FunctionalTensor)
Addition operator.
Declaration
public static FunctionalTensor operator +(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to add. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value added to each element. |
Remarks
This operator adds a constant float value to every element in the tensor. The tensor is promoted to float type if necessary.
operator +(FunctionalTensor, int)
Addition operator.
Declaration
public static FunctionalTensor operator +(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| int | b | The scalar integer value to add. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value added to each element. |
Remarks
This operator adds a constant integer value to every element in the tensor.
operator +(FunctionalTensor, float)
Addition operator.
Declaration
public static FunctionalTensor operator +(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| float | b | The scalar float value to add. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value added to each element. |
Remarks
This operator adds a constant float value to every element in the tensor. The tensor is promoted to float type if necessary.
operator +(FunctionalTensor, FunctionalTensor)
Addition operator.
Declaration
public static FunctionalTensor operator +(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor. |
| FunctionalTensor | b | The second functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise sum of the two inputs. |
Remarks
This operator performs element-wise addition between two functional tensors. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling Add(FunctionalTensor, FunctionalTensor).
operator &(bool, FunctionalTensor)
And operator.
Declaration
public static FunctionalTensor operator &(bool a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | a | The boolean value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise AND with the boolean. |
Remarks
This operator performs element-wise bitwise AND between a boolean value and the tensor.
The boolean is converted to 1 (true) or 0 (false) before the operation.
This overload supports commutative AND (bool & tensor = tensor & bool).
operator &(int, FunctionalTensor)
And operator.
Declaration
public static FunctionalTensor operator &(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element ANDed with the scalar. |
Remarks
This operator performs element-wise bitwise AND between a constant integer value and every element in the tensor. This overload supports commutative AND (int & tensor = tensor & int).
operator &(FunctionalTensor, bool)
And operator.
Declaration
public static FunctionalTensor operator &(FunctionalTensor a, bool b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| bool | b | The boolean value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise AND with the boolean. |
Remarks
This operator performs element-wise bitwise AND between the tensor and a boolean value.
The boolean is converted to 1 (true) or 0 (false) before the operation.
operator &(FunctionalTensor, int)
And operator.
Declaration
public static FunctionalTensor operator &(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| int | b | The scalar integer value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element ANDed with the scalar. |
Remarks
This operator performs element-wise bitwise AND between every element in the tensor and a constant integer value.
operator &(FunctionalTensor, FunctionalTensor)
And operator.
Declaration
public static FunctionalTensor operator &(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor. |
| FunctionalTensor | b | The second functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise AND of the two inputs. |
Remarks
This operator performs element-wise bitwise AND between two functional tensors. For each corresponding pair of elements, the result has bits set only where both inputs have bits set. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling BitwiseAnd(FunctionalTensor, FunctionalTensor).
operator |(bool, FunctionalTensor)
Or operator.
Declaration
public static FunctionalTensor operator |(bool a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | a | The boolean value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise OR with the boolean. |
Remarks
This operator performs element-wise bitwise OR between a boolean value and the tensor.
The boolean is converted to 1 (true) or 0 (false) before the operation.
This overload supports commutative OR (bool | tensor = tensor | bool).
operator |(int, FunctionalTensor)
Or operator.
Declaration
public static FunctionalTensor operator |(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element ORed with the scalar. |
Remarks
This operator performs element-wise bitwise OR between a constant integer value and every element in the tensor. This overload supports commutative OR (int | tensor = tensor | int).
operator |(FunctionalTensor, bool)
Or operator.
Declaration
public static FunctionalTensor operator |(FunctionalTensor a, bool b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| bool | b | The boolean value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise OR with the boolean. |
Remarks
This operator performs element-wise bitwise OR between the tensor and a boolean value.
The boolean is converted to 1 (true) or 0 (false) before the operation.
operator |(FunctionalTensor, int)
Or operator.
Declaration
public static FunctionalTensor operator |(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| int | b | The scalar integer value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element ORed with the scalar. |
Remarks
This operator performs element-wise bitwise OR between every element in the tensor and a constant integer value.
operator |(FunctionalTensor, FunctionalTensor)
Or operator.
Declaration
public static FunctionalTensor operator |(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor. |
| FunctionalTensor | b | The second functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise OR of the two inputs. |
Remarks
This operator performs element-wise bitwise OR between two functional tensors. For each corresponding pair of elements, the result has bits set where either input has bits set. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling BitwiseOr(FunctionalTensor, FunctionalTensor).
operator /(int, FunctionalTensor)
Division operator.
Declaration
public static FunctionalTensor operator /(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to divide. |
| FunctionalTensor | b | The functional tensor to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar divided by each element. |
Remarks
This operator divides a constant integer value by every element in the tensor. For integer tensors, this performs integer division.
operator /(float, FunctionalTensor)
Division operator.
Declaration
public static FunctionalTensor operator /(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to divide. |
| FunctionalTensor | b | The functional tensor to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar divided by each element. |
Remarks
This operator divides a constant float value by every element in the tensor. The tensor is promoted to float type if necessary.
operator /(FunctionalTensor, int)
Division operator.
Declaration
public static FunctionalTensor operator /(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide. |
| int | b | The scalar integer value to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element divided by the scalar value. |
Remarks
This operator divides every element in the tensor by a constant integer value. For integer tensors, this performs integer division.
operator /(FunctionalTensor, float)
Division operator.
Declaration
public static FunctionalTensor operator /(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide. |
| float | b | The scalar float value to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element divided by the scalar value. |
Remarks
This operator divides every element in the tensor by a constant float value. The tensor is promoted to float type if necessary.
operator /(FunctionalTensor, FunctionalTensor)
Division operator.
Declaration
public static FunctionalTensor operator /(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide. |
| FunctionalTensor | b | The functional tensor to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise quotient. |
Remarks
This operator performs element-wise division between two functional tensors. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling Div(FunctionalTensor, FunctionalTensor).
operator ^(bool, FunctionalTensor)
Xor operator.
Declaration
public static FunctionalTensor operator ^(bool a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | a | The boolean value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise XOR with the boolean. |
Remarks
This operator performs element-wise bitwise XOR between a boolean value and the tensor.
The boolean is converted to 1 (true) or 0 (false) before the operation.
This overload supports commutative XOR (bool ^ tensor = tensor ^ bool).
operator ^(int, FunctionalTensor)
Xor operator.
Declaration
public static FunctionalTensor operator ^(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element XORed with the scalar. |
Remarks
This operator performs element-wise bitwise XOR between a constant integer value and every element in the tensor. This overload supports commutative XOR (int ^ tensor = tensor ^ int).
operator ^(FunctionalTensor, bool)
Xor operator.
Declaration
public static FunctionalTensor operator ^(FunctionalTensor a, bool b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| bool | b | The boolean value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise XOR with the boolean. |
Remarks
This operator performs element-wise bitwise XOR between the tensor and a boolean value.
operator ^(FunctionalTensor, int)
Xor operator.
Declaration
public static FunctionalTensor operator ^(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| int | b | The scalar integer value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element XORed with the scalar. |
Remarks
This operator performs element-wise bitwise XOR between every element in the tensor and a constant integer value.
operator ^(FunctionalTensor, FunctionalTensor)
Xor operator.
Declaration
public static FunctionalTensor operator ^(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor. |
| FunctionalTensor | b | The second functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise XOR of the two inputs. |
Remarks
This operator performs element-wise bitwise exclusive-or between two functional tensors. For each corresponding pair of elements, the result has bits set where the inputs differ. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling BitwiseXor(FunctionalTensor, FunctionalTensor).
operator >(int, FunctionalTensor)
Greater than operator.
Declaration
public static FunctionalTensor operator >(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant integer value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar > element, and 0 otherwise.
operator >(float, FunctionalTensor)
Greater than operator.
Declaration
public static FunctionalTensor operator >(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant float value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar > element, and 0 otherwise.
operator >(FunctionalTensor, int)
Greater than operator.
Declaration
public static FunctionalTensor operator >(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| int | b | The scalar integer value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant integer value.
Returns an integer tensor where each element is 1 if element > scalar, and 0 otherwise.
operator >(FunctionalTensor, float)
Greater than operator.
Declaration
public static FunctionalTensor operator >(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| float | b | The scalar float value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant float value.
Returns an integer tensor where each element is 1 if element > scalar, and 0 otherwise.
For integer tensors, the float is floored before comparison.
operator >(FunctionalTensor, FunctionalTensor)
Greater than operator.
Declaration
public static FunctionalTensor operator >(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor to compare. |
| FunctionalTensor | b | The second functional tensor to compare. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator performs element-wise comparison between two functional tensors.
Returns an integer tensor where each element is 1 if a > b, and 0 otherwise.
The tensors are broadcasted to a compatible shape if necessary.
This is equivalent to calling Greater(FunctionalTensor, FunctionalTensor).
operator >=(int, FunctionalTensor)
Greater than or equal operator.
Declaration
public static FunctionalTensor operator >=(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant integer value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar >= element, and 0 otherwise.
operator >=(float, FunctionalTensor)
Greater than or equal operator.
Declaration
public static FunctionalTensor operator >=(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant float value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar >= element, and 0 otherwise.
operator >=(FunctionalTensor, int)
Greater than or equal operator.
Declaration
public static FunctionalTensor operator >=(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| int | b | The scalar integer value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant integer value.
Returns an integer tensor where each element is 1 if element >= scalar, and 0 otherwise.
operator >=(FunctionalTensor, float)
Greater than or equal operator.
Declaration
public static FunctionalTensor operator >=(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| float | b | The scalar float value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant float value.
Returns an integer tensor where each element is 1 if element >= scalar, and 0 otherwise.
For integer tensors, the float is ceiled before comparison.
operator >=(FunctionalTensor, FunctionalTensor)
Greater than or equal operator.
Declaration
public static FunctionalTensor operator >=(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor to compare. |
| FunctionalTensor | b | The second functional tensor to compare. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator performs element-wise comparison between two functional tensors.
Returns an integer tensor where each element is 1 if a[i] >= b[i], and 0 otherwise.
The tensors are broadcasted to a compatible shape if necessary.
This is equivalent to calling GreaterEqual(FunctionalTensor, FunctionalTensor).
operator <(int, FunctionalTensor)
Less than operator.
Declaration
public static FunctionalTensor operator <(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant integer value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar < element, and 0 otherwise.
operator <(float, FunctionalTensor)
Less than operator.
Declaration
public static FunctionalTensor operator <(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant float value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar < element, and 0 otherwise.
operator <(FunctionalTensor, int)
Less than operator.
Declaration
public static FunctionalTensor operator <(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| int | b | The scalar integer value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant integer value.
Returns an integer tensor where each element is 1 if element < scalar, and 0 otherwise.
operator <(FunctionalTensor, float)
Less than operator.
Declaration
public static FunctionalTensor operator <(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| float | b | The scalar float value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant float value.
Returns an integer tensor where each element is 1 if element < scalar, and 0 otherwise.
For integer tensors, the float is ceiled before comparison.
operator <(FunctionalTensor, FunctionalTensor)
Less than operator.
Declaration
public static FunctionalTensor operator <(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor to compare. |
| FunctionalTensor | b | The second functional tensor to compare. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator performs element-wise comparison between two functional tensors.
Returns an integer tensor where each element is 1 if a[i] < b[i], and 0 otherwise.
The tensors are broadcasted to a compatible shape if necessary.
This is equivalent to calling Less(FunctionalTensor, FunctionalTensor).
operator <=(int, FunctionalTensor)
Less than or equal operator.
Declaration
public static FunctionalTensor operator <=(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant integer value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar <= element, and 0 otherwise.
operator <=(float, FunctionalTensor)
Less than or equal operator.
Declaration
public static FunctionalTensor operator <=(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to compare. |
| FunctionalTensor | b | The functional tensor to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares a constant float value with every element in the tensor.
Returns an integer tensor where each element is 1 if scalar <= element, and 0 otherwise.
operator <=(FunctionalTensor, int)
Less than or equal operator.
Declaration
public static FunctionalTensor operator <=(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| int | b | The scalar integer value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant integer value.
Returns an integer tensor where each element is 1 if element <= scalar, and 0 otherwise.
operator <=(FunctionalTensor, float)
Less than or equal operator.
Declaration
public static FunctionalTensor operator <=(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to compare. |
| float | b | The scalar float value to compare with. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator compares every element in the tensor with a constant float value.
Returns an integer tensor where each element is 1 if element <= scalar, and 0 otherwise.
For integer tensors, the float is floored before comparison.
operator <=(FunctionalTensor, FunctionalTensor)
Less than or equal operator.
Declaration
public static FunctionalTensor operator <=(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor to compare. |
| FunctionalTensor | b | The second functional tensor to compare. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | An integer functional tensor with |
Remarks
This operator performs element-wise comparison between two functional tensors.
Returns an integer tensor where each element is 1 if a[i] <= b[i], and 0 otherwise.
The tensors are broadcasted to a compatible shape if necessary.
This is equivalent to calling LessEqual(FunctionalTensor, FunctionalTensor).
operator %(int, FunctionalTensor)
Remainder operator.
Declaration
public static FunctionalTensor operator %(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to divide. |
| FunctionalTensor | b | The functional tensor to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar modulo each element. |
Remarks
This operator computes the remainder when dividing a constant integer value by every element in the tensor.
operator %(float, FunctionalTensor)
Remainder operator.
Declaration
public static FunctionalTensor operator %(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to divide. |
| FunctionalTensor | b | The functional tensor to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar modulo each element. |
Remarks
This operator computes the remainder when dividing a constant float value by every element in the tensor.
operator %(FunctionalTensor, int)
Remainder operator.
Declaration
public static FunctionalTensor operator %(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide. |
| int | b | The scalar integer value to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the remainder of each element divided by the scalar. |
Remarks
This operator computes the remainder when dividing every element in the tensor by a constant integer value.
operator %(FunctionalTensor, float)
Remainder operator.
Declaration
public static FunctionalTensor operator %(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide. |
| float | b | The scalar float value to divide by. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the remainder of each element divided by the scalar. |
Remarks
This operator computes the remainder when dividing every element in the tensor by a constant float value.
operator %(FunctionalTensor, FunctionalTensor)
Remainder operator.
Declaration
public static FunctionalTensor operator %(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to divide (dividend). |
| FunctionalTensor | b | The functional tensor to divide by (divisor). |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise remainder. |
Remarks
This operator computes the element-wise remainder (modulo operation) between two functional tensors.
The tensors are broadcasted to a compatible shape if necessary.
This is equivalent to calling Remainder(FunctionalTensor, FunctionalTensor).
For element a and b, the result is a - floor(a/b) * b.
operator *(int, FunctionalTensor)
Multiplication operator.
Declaration
public static FunctionalTensor operator *(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element multiplied by the scalar value. |
Remarks
This operator multiplies every element in the tensor by a constant integer value. This overload supports commutative multiplication (scalar * tensor = tensor * scalar).
operator *(float, FunctionalTensor)
Multiplication operator.
Declaration
public static FunctionalTensor operator *(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value. |
| FunctionalTensor | b | The functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element multiplied by the scalar value. |
Remarks
This operator multiplies every element in the tensor by a constant float value. The tensor is promoted to float type if necessary.
operator *(FunctionalTensor, int)
Multiplication operator.
Declaration
public static FunctionalTensor operator *(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| int | b | The scalar integer value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element multiplied by the scalar value. |
Remarks
This operator multiplies every element in the tensor by a constant integer value.
operator *(FunctionalTensor, float)
Multiplication operator.
Declaration
public static FunctionalTensor operator *(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor. |
| float | b | The scalar float value. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element multiplied by the scalar value. |
Remarks
This operator multiplies every element in the tensor by a constant float value. The tensor is promoted to float type if necessary.
operator *(FunctionalTensor, FunctionalTensor)
Multiply operator.
Declaration
public static FunctionalTensor operator *(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The first functional tensor. |
| FunctionalTensor | b | The second functional tensor. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise product. |
Remarks
This operator performs element-wise multiplication between two functional tensors. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling Mul(FunctionalTensor, FunctionalTensor).
operator ~(FunctionalTensor)
Unary not operator.
Declaration
public static FunctionalTensor operator ~(FunctionalTensor a)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to negate bitwise. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the bitwise NOT of each element. |
Remarks
This operator performs element-wise bitwise negation (complement) of the input tensor. For each element, all bits are inverted. This is equivalent to calling BitwiseNot(FunctionalTensor). This operator is typically used with integer tensors.
operator -(int, FunctionalTensor)
Subtraction operator.
Declaration
public static FunctionalTensor operator -(int a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| int | a | The scalar integer value to subtract from. |
| FunctionalTensor | b | The functional tensor to subtract. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element subtracted from the scalar value. |
Remarks
This operator subtracts every element in the tensor from a constant integer value.
operator -(float, FunctionalTensor)
Subtraction operator.
Declaration
public static FunctionalTensor operator -(float a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| float | a | The scalar float value to subtract from. |
| FunctionalTensor | b | The functional tensor to subtract. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with each element subtracted from the scalar value. |
Remarks
This operator subtracts every element in the tensor from a constant float value. The tensor is promoted to float type if necessary.
operator -(FunctionalTensor, int)
Subtraction operator.
Declaration
public static FunctionalTensor operator -(FunctionalTensor a, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to subtract from. |
| int | b | The scalar integer value to subtract. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value subtracted from each element. |
Remarks
This operator subtracts a constant integer value from every element in the tensor. The tensor is promoted to float type if necessary.
operator -(FunctionalTensor, float)
Subtraction operator.
Declaration
public static FunctionalTensor operator -(FunctionalTensor a, float b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to subtract from. |
| float | b | The scalar float value to subtract. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor with the scalar value subtracted from each element. |
Remarks
This operator subtracts a constant float value from every element in the tensor. The tensor is promoted to float type if necessary.
operator -(FunctionalTensor, FunctionalTensor)
Subtraction operator.
Declaration
public static FunctionalTensor operator -(FunctionalTensor a, FunctionalTensor b)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to subtract from. |
| FunctionalTensor | b | The functional tensor to subtract. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise difference. |
Remarks
This operator performs element-wise subtraction between two functional tensors. The tensors are broadcasted to a compatible shape if necessary. This is equivalent to calling Sub(FunctionalTensor, FunctionalTensor).
operator -(FunctionalTensor)
Unary negation operator.
Declaration
public static FunctionalTensor operator -(FunctionalTensor a)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor to negate. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | A functional tensor containing the element-wise negation of the input. |
Remarks
This operator computes the element-wise negation of the input tensor. This is equivalent to calling Neg(FunctionalTensor).
operator +(FunctionalTensor)
Unary plus operator.
Declaration
public static FunctionalTensor operator +(FunctionalTensor a)
Parameters
| Type | Name | Description |
|---|---|---|
| FunctionalTensor | a | The functional tensor operand. |
Returns
| Type | Description |
|---|---|
| FunctionalTensor | The input tensor unchanged. |
Remarks
This operator returns the input tensor unchanged. It exists for symmetry with the unary negation operator and to support explicit positive notation in expressions.