Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit d9c96f9

Browse files
committed
Fox inverted W/H parameters
1 parent afae65b commit d9c96f9

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

OnnxStack.StableDiffusion/Diffusers/LatentConsistency/ImageDiffuser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ protected override IReadOnlyList<int> GetTimesteps(PromptOptions prompt, Schedul
5252
protected override DenseTensor<float> PrepareLatents(IModelOptions model, PromptOptions prompt, SchedulerOptions options, IScheduler scheduler, IReadOnlyList<int> timesteps)
5353
{
5454
// Image input, decode, add noise, return as latent 0
55-
var imageTensor = prompt.InputImage.ToDenseTensor(new[] { 1, 3, options.Width, options.Height });
55+
var imageTensor = prompt.InputImage.ToDenseTensor(new[] { 1, 3, options.Height, options.Width });
5656
var inputNames = _onnxModelService.GetInputNames(model, OnnxModelType.VaeEncoder);
5757
var inputParameters = CreateInputParameters(NamedOnnxValue.CreateFromTensor(inputNames[0], imageTensor));
5858
using (var inferResult = _onnxModelService.RunInference(model, OnnxModelType.VaeEncoder, inputParameters))

OnnxStack.StableDiffusion/Diffusers/StableDiffusion/ImageDiffuser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ protected override IReadOnlyList<int> GetTimesteps(PromptOptions prompt, Schedul
5353
protected override DenseTensor<float> PrepareLatents(IModelOptions model, PromptOptions prompt, SchedulerOptions options, IScheduler scheduler, IReadOnlyList<int> timesteps)
5454
{
5555
// Image input, decode, add noise, return as latent 0
56-
var imageTensor = prompt.InputImage.ToDenseTensor(new[] { 1, 3, options.Width, options.Height });
56+
var imageTensor = prompt.InputImage.ToDenseTensor(new[] { 1, 3, options.Height, options.Width });
5757
var inputNames = _onnxModelService.GetInputNames(model, OnnxModelType.VaeEncoder);
5858
var inputParameters = CreateInputParameters(NamedOnnxValue.CreateFromTensor(inputNames[0], imageTensor));
5959
using (var inferResult = _onnxModelService.RunInference(model, OnnxModelType.VaeEncoder, inputParameters))

OnnxStack.StableDiffusion/Helpers/ImageHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private static DenseTensor<float> ProcessPixels(Image<Rgba32> image, ReadOnlySpa
260260
var width = dimensions[3];
261261
var height = dimensions[2];
262262
var channels = dimensions[1];
263-
var imageArray = new DenseTensor<float>(new[] { 1, channels, width, height });
263+
var imageArray = new DenseTensor<float>(new[] { 1, channels, height, width });
264264
image.ProcessPixelRows(img =>
265265
{
266266
for (int x = 0; x < width; x++)

OnnxStack.UI/UserControls/ImageInputControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<Border DataContext="{Binding ElementName=UI}" BorderBrush="LightGray" BorderThickness="2" >
2121
<StackPanel Margin="2" >
22-
<Canvas MinHeight="512" MinWidth="512" >
22+
<Canvas Width="{Binding SchedulerOptions.Width}" Height="{Binding SchedulerOptions.Height}" MinHeight="512" MinWidth="512" ClipToBounds="True">
2323
<Image Source="{Binding Result.Image, FallbackValue={StaticResource PlaceholderImage}, TargetNullValue={StaticResource PlaceholderImage}}" Width="{Binding SchedulerOptions.Width}" Height="{Binding SchedulerOptions.Height}" MinHeight="512" MinWidth="512">
2424
<Image.ContextMenu>
2525
<ContextMenu>

0 commit comments

Comments
 (0)