Skip to content

Commit 80fce55

Browse files
committed
Rename GetImageNumChannels and update references
Renamed the method `GetImageNumChannels` to `get_image_num_channels` in `Functional.cs`. Added a summary documentation comment to the `get_image_num_channels` method, detailing its purpose, parameter, and return value. Updated the call to this method in `Normalize.cs` to reflect the new name.
1 parent 2e72fac commit 80fce55

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/TorchVision/Functional.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ private static bool AssertTensorImage(Tensor img)
3737
return true;
3838
}
3939

40-
public static long GetImageNumChannels(Tensor img)
40+
/// <summary>
41+
/// Returns the number of channels of an image.
42+
/// </summary>
43+
/// <param name="img">(Tensor) – The image to be checked.</param>
44+
/// <returns>The number of channels.</returns>
45+
public static long get_image_num_channels(Tensor img)
4146
{
4247
AssertTensorImage(img);
4348
var ndim_ = img.ndim;

src/TorchVision/Normalize.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ internal Normalize(double[] means, double[] stdevs,bool inplace = false)
2323

2424
public Tensor call(Tensor input)
2525
{
26-
var expectedChannels = transforms.functional.GetImageNumChannels(input);
26+
var expectedChannels = transforms.functional.get_image_num_channels(input);
2727
if (expectedChannels != means.Length)
2828
throw new ArgumentException("The number of channels is not equal to the number of means and standard deviations");
2929
return transforms.functional.normalize(input, means, stdevs, inplace);

0 commit comments

Comments
 (0)