Accessing Tensor Elements in IronPython QuickStart Sample
Illustrates different ways of accessing elements of a tensor and sub-tensors using classes in the Numerics.NET.Tensors namespace in IronPython.
This sample is also available in: C#, Visual Basic, F#.
Overview
This QuickStart sample demonstrates the various ways to access and manipulate elements within tensors using Numerics.NET. It covers both basic and advanced indexing techniques that are essential for working with multidimensional data structures.
The sample illustrates:
- Basic indexing to access individual elements and slices of tensors
- Using C# 8.0’s caret (^) operator for end-relative indexing
- Working with ranges and slices to access sub-tensors
- Advanced indexing techniques using integer arrays and boolean masks
- Understanding the difference between shallow copies and deep copies of tensors
- Setting values in tensors using various indexing methods
- Using strides for more complex slice operations
- Working with multi-dimensional tensors
The code provides practical examples of each technique, making it easy to understand how to effectively work with tensor data structures in your applications. Each operation is demonstrated with clear examples showing both the syntax and the resulting tensor structure.
The code
Coming soon...