Skip to content

Commit

Permalink
Fix creating wrong dimension tensor.
Browse files Browse the repository at this point in the history
How can I write the arguments in wrong places?!

Signed-off-by: net2cn <[email protected]>
  • Loading branch information
net2cn committed Mar 26, 2022
1 parent 7e460e1 commit 1d0dba1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
18 changes: 10 additions & 8 deletions Real-ESRGAN_GUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
</GroupBox>
<ProgressBar local:ProgressBarSmoother.SmoothValue="{Binding Logger.Progress}" x:Name="ProgressBar" Height="25" Margin="10,192,10,0" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
<Border BorderThickness="1" BorderBrush="Black" Margin="10,222,10,10" Grid.ColumnSpan="2">
<TextBlock x:Name="LogTextBlock" Margin="0,0,0,-1" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Auto">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource ListToStringConverter}">
<Binding Path="Logger.Buffer" Mode="OneWay"/>
<Binding Path="Logger.Buffer.Count" Mode="OneWay" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
<ScrollViewer VerticalScrollBarVisibility="Auto" CanContentScroll="True">
<TextBlock x:Name="LogTextBlock" Margin="0,0,0,-1" TextWrapping="Wrap" ScrollViewer.VerticalScrollBarVisibility="Auto">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource ListToStringConverter}">
<Binding Path="Logger.Buffer" Mode="OneWay"/>
<Binding Path="Logger.Buffer.Count" Mode="OneWay" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</ScrollViewer>
</Border>
<Button x:Name="CancelButton" Content="Cancel" Grid.Column="1" Margin="0,163,70,0" VerticalAlignment="Top" Height="25" RenderTransformOrigin="0.116,0.79" HorizontalAlignment="Right" Width="55" Click="CancelButton_Click"/>
<Button x:Name="StartButton" Content="Start" Grid.Column="1" Margin="0,163,10,0" VerticalAlignment="Top" Height="25" Click="StartButton_ClickAsync" HorizontalAlignment="Right" Width="55"/>
Expand Down
4 changes: 4 additions & 0 deletions Real-ESRGAN_GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ private async void StartButton_ClickAsync(object sender, RoutedEventArgs e)
{
Logger.Log("Operation was cancelled by user.");
}
catch
{
throw;
}
finally
{
model.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion Real-ESRGAN_GUI/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public async Task<Tensor<float>> Inference(Tensor<float> input)
public static Tensor<float> ConvertImageToFloatTensorUnsafe(Bitmap image)
{
// Create the Tensor with the appropiate dimensions for the NN
Tensor<float> data = new DenseTensor<float>(new[] { 1, 3, image.Height, image.Width });
Tensor<float> data = new DenseTensor<float>(new[] { 1, 3, image.Width, image.Height });

BitmapData bmd = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadOnly, image.PixelFormat);
int PixelSize = 3;
Expand Down

0 comments on commit 1d0dba1

Please sign in to comment.