Skip to content

Potential bug with Tensor.Reverse #124105

@vcsjones

Description

@vcsjones

Consider the following snippet:

#pragma warning disable SYSLIB5001
using System;
using System.Numerics.Tensors;

int[] data = [1, 2, 3];
var tensor = Tensor.Create<int>(data, [1, 3]);
var reversed = Tensor.Reverse<int>(tensor);
Console.WriteLine($"Got: [[{reversed[0, 0]}, {reversed[0, 1]}, {reversed[0, 2]}]]");

With version 9.0 of S.N.Tensors, this prints

Got: [[3, 2, 1]]

However with version 10.0.2 of S.N.Tensors, this prints

Got: [[0, 2, 1]]

The behavior of the 9.0 package seems correct here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions