Skip to content

torchvision.transforms.functional.affine throws IndexError #1502

@K1T00

Description

@K1T00

Describe the bug
torchvision.transforms.functional.affine() throws "Can only index with tensors that are scalars (zero-dim) native IndexError"

To Reproduce

using F = TorchSharp.torchvision.transforms.functional;

var img =
	F.affine(
		rand(new long[] { 1, 1, 48, 48 }),
		angle: 0f,
		translate: new[] { 0, 0 },
		scale: 1f,
		shear: new[] { 1f, 1f },
		interpolation: InterpolationMode.Bilinear,
		fill: 0);

Expected behavior
Should work with tensor that is 4D, float32 and on CPU

Please complete the following information:

  • OS: Windows 11
  • Package Type torchsharp-cuda-windows
  • Version 0.105.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions