Skip to content

Tensor.Resize returns unexpected values when start is greater than 0 #128512

Closed

Description

@prozolic

Description

When it use Tensor.Resize with Tensor whose starting postion(start) is greater than 0, the resulting values differ from the expected value.
For example, resizing a Tensor created with Tensor.Create([1, 2, 3, 4, 5, 6], start: 2, lengths: [4], strides: []) produces a Tensor containing [5, 6, 0, 0] instead of [3, 4, 5, 6].

Reproduction Steps

Tensor<int> tensor = Tensor.Create([1, 2, 3, 4, 5, 6], start: 2, lengths: [4], strides: []);  // return [3, 4, 5, 6]
Tensor<int> resizedTensor = Tensor.Resize(tensor, [4]); // [5, 6, 0, 0] (should return [3, 4, 5, 6]) 

Expected behavior

The resized Tensor starts from _values[_start]

Actual behavior

The resized Tensor starts from _values[_start * 2] because _start is applied twice.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

I have created a pull request (#128511).

Activity

  1. added
    untriaged
    on May 23, 2026
  2. dotnet-policy-service commented on May 23, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-numerics-tensors
    See info in area-owners.md if you want to be subscribed.

  3. removed
    untriaged
    on Aug 17, 2026
  4. added this to the 11.0.0 milestone on Aug 17, 2026
  5. added 2 commits that reference this issue on Aug 18, 2026
    349ddb7
    1c4703c
  6. locked and limited conversation to collaborators on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions