Skip to content

Commit 1764c73

Browse files
Add more compatibility handling.
1 parent b1b2128 commit 1764c73

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/TorchVision/Functional.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,18 @@ public static Tensor resize(Tensor input, int height, int width, int? maxSize =
765765
return resize(input, height, width, InterpolationMode.Nearest, maxSize, false);
766766
}
767767

768+
/// <summary>
769+
/// Resize the input image to the given size.
770+
/// </summary>
771+
/// <param name="input">An image tensor.</param>
772+
/// <param name="height">The height of the resized image. Must be > 0.</param>
773+
/// <param name="width">The width of the resized image. Must be > 0.</param>
774+
/// <returns></returns>
775+
public static Tensor resize(Tensor input, int height, int width)
776+
{
777+
return resize(input, height, width, InterpolationMode.Nearest, null, false);
778+
}
779+
768780
/// <summary>
769781
/// Crop the given image and resize it to desired size.
770782
/// </summary>

src/TorchVision/Resize.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ static public ITransform Resize(int height, int width, int? maxSize = null)
8888
return new Resize(height, width, InterpolationMode.Nearest, maxSize, false);
8989
}
9090

91+
/// <summary>
92+
/// Resize the input image to the given size.
93+
/// </summary>
94+
/// <param name="height">Desired output height</param>
95+
/// <param name="width">Desired output width</param>
96+
/// <returns></returns>
97+
static public ITransform Resize(int height, int width)
98+
{
99+
return new Resize(height, width, InterpolationMode.Nearest, null, false);
100+
}
101+
91102
/// <summary>
92103
/// Resize the input image to the given size.
93104
/// </summary>
@@ -97,6 +108,15 @@ static public ITransform Resize(int size, int? maxSize = null)
97108
{
98109
return new Resize(size, -1, InterpolationMode.Nearest, maxSize, false);
99110
}
111+
112+
/// <summary>
113+
/// Resize the input image to the given size.
114+
/// </summary>
115+
/// <param name="size">Desired output size</param>
116+
static public ITransform Resize(int size)
117+
{
118+
return new Resize(size, -1, InterpolationMode.Nearest, null, false);
119+
}
100120
}
101121
}
102122
}

0 commit comments

Comments
 (0)