Skip to content

fix flip_left_right run bug #1143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/TensorFlowNET.Core/Operations/image_ops_impl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ internal static Tensor _random_flip(Tensor image, int flip_index, int seed, stri
}

public static Tensor flip_left_right(Tensor image)
=> _flip(image, 1, "flip_left_right");
=> _flip(image, 0, "flip_left_right");

public static Tensor flip_up_down(Tensor image)
=> _flip(image, 1, "flip_up_down");
Expand All @@ -226,7 +226,7 @@ internal static Tensor _flip(Tensor image, int flip_index, string scope_name)
}
else if (shape.ndim == 4)
{
return gen_array_ops.reverse(image, ops.convert_to_tensor(new[] { flip_index + 1 }));
return gen_array_ops.reverse_v2(image, ops.convert_to_tensor(new[] { (flip_index + 1) % 2 }));
}
else
{
Expand Down