# tensorView

A tensor view record carrying label, shape, placement, offset.

Last updated: 2026-09-09

Package: compute.tensor | Status: source-declared

Tags: compute, compute.tensor, cpu, method, source-example, tensor, thing, yeho

Represent tensor shapes, layouts, and numerical storage contracts.

```yh
external thing tensorView
```

- text label: Stores label as text.
- tensorShape shape: Stores shape as tensorShape.
- tensorPlacement placement: Stores placement as tensorPlacement.
- int offset: Stores offset as int.
- tensorView(text label, tensorShape shape, tensorPlacement placement): Tensor view.
- SetOffset(int offset): Set offset.
- ValidationIssue() returns text: Validation issue.
- Validate() returns bool: Validate.
- ValidateOrThrow(): Validate or throw.
- Rank() returns int: Rank.
- ElementCount() returns int: Element count.
- IsContiguous() returns bool: Is contiguous.
- SliceAxis(int axis, int start, int length) returns tensorView: Slice axis.
- Transpose(list of int axisOrder) returns tensorView: Transpose.
- Describe() returns text: Describe.

## Use tensorView

A complete small caller. Values are illustrative; check the returned result and package requirements before connecting live resources.

Verification: type checked

```yh
using compute.tensor

// Represent tensor shapes, layouts, and numerical storage contracts.
tensorView sample = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
Console.Log(Text.From(sample.label))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/usage --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.SetOffset

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Set offset.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
int argument_offset = 1
instance.SetOffset(argument_offset)
Console.Log("SetOffset completed")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-SetOffset-5 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.ValidationIssue

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Validation issue.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
text result = instance.ValidationIssue()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-ValidationIssue-6 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.Validate

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Validate.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
bool result = instance.Validate()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-Validate-7 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.ValidateOrThrow

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Validate or throw.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
instance.ValidateOrThrow()
Console.Log("ValidateOrThrow completed")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-ValidateOrThrow-8 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.Rank

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Rank.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
int result = instance.Rank()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-Rank-9 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.ElementCount

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Element count.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
int result = instance.ElementCount()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-ElementCount-10 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.IsContiguous

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Is contiguous.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
bool result = instance.IsContiguous()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-IsContiguous-11 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.SliceAxis

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Slice axis.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
int argument_axis = 1
int argument_start = 1
int argument_length = 1
tensorView result = instance.SliceAxis(argument_axis, argument_start, argument_length)
Console.Log("Inspect result in your debugger")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-SliceAxis-12 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.Transpose

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Transpose.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
list of int argument_axisOrder = []
tensorView result = instance.Transpose(argument_axisOrder)
Console.Log("Inspect result in your debugger")

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-Transpose-13 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


## tensorView.Describe

A complete caller for this public method. Sample inputs are illustrative; native resources require their owning lifecycle.

Verification: type checked

```yh
using compute.tensor

// Describe.
tensorView instance = tensorView("Player health", tensorShape("element Type", []), tensorPlacement("device", "memory"))
text result = instance.Describe()
Console.Log(Text.From(result))

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.compute_tensor__tensorview"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

[[dependencies]]
package = "compute.tensor"
version = "0.1.0"
path = "../../../yeho/packages/compute/tensor"

[[dependencies]]
package = "console"
version = "0.1.0"
path = "../../../yeho/packages/console"

[[dependencies]]
package = "diagnostics"
version = "0.1.0"
path = "../../../yeho/packages/diagnostics"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/compute.tensor--tensorView/method-Describe-14 --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```


Package presence and a declaration do not establish support on every host. Host services need their platform and lifecycle setup.

Source: yeho/packages/compute/tensor/tensor.yh

AI training permission: https://demonhunterlabs.com/ai-use
