Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
87ab25fa
"git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "4287fd21933ae968b5455a8784edda4acaa1407a"
Commit
87ab25fa
authored
May 25, 2023
by
comfyanonymous
Browse files
Do operations in same order as the one it replaces.
parent
2b1fac97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
comfy/utils.py
comfy/utils.py
+15
-17
No files found.
comfy/utils.py
View file @
87ab25fa
...
@@ -98,29 +98,27 @@ def bislerp(samples, width, height):
...
@@ -98,29 +98,27 @@ def bislerp(samples, width, height):
n
,
c
,
h
,
w
=
samples
.
shape
n
,
c
,
h
,
w
=
samples
.
shape
h_new
,
w_new
=
(
height
,
width
)
h_new
,
w_new
=
(
height
,
width
)
#linear h
#linear w
ratios
,
coords_1
,
coords_2
=
generate_bilinear_data
(
h
,
h_new
)
ratios
,
coords_1
,
coords_2
=
generate_bilinear_data
(
w
,
w_new
)
coords_1
=
coords_1
.
expand
((
n
,
c
,
h
,
-
1
))
coords_1
=
coords_1
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
c
,
-
1
,
w
))
coords_2
=
coords_2
.
expand
((
n
,
c
,
h
,
-
1
))
coords_2
=
coords_2
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
c
,
-
1
,
w
))
ratios
=
ratios
.
expand
((
n
,
1
,
h
,
-
1
))
ratios
=
ratios
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
1
,
-
1
,
w
))
pass_1
=
einops
.
rearrange
(
samples
.
gather
(
-
2
,
coords_1
),
'n c h w -> (n h w) c'
)
pass_1
=
einops
.
rearrange
(
samples
.
gather
(
-
1
,
coords_1
),
'n c h w -> (n h w) c'
)
pass_2
=
einops
.
rearrange
(
samples
.
gather
(
-
2
,
coords_2
),
'n c h w -> (n h w) c'
)
pass_2
=
einops
.
rearrange
(
samples
.
gather
(
-
1
,
coords_2
),
'n c h w -> (n h w) c'
)
ratios
=
einops
.
rearrange
(
ratios
,
'n c h w -> (n h w) c'
)
ratios
=
einops
.
rearrange
(
ratios
,
'n c h w -> (n h w) c'
)
result
=
slerp
(
pass_1
,
pass_2
,
ratios
)
result
=
slerp
(
pass_1
,
pass_2
,
ratios
)
result
=
einops
.
rearrange
(
result
,
'(n h w) c -> n c h w'
,
n
=
n
,
h
=
h
_new
,
w
=
w
)
result
=
einops
.
rearrange
(
result
,
'(n h w) c -> n c h w'
,
n
=
n
,
h
=
h
,
w
=
w_ne
w
)
#linear w
#linear h
ratios
,
coords_1
,
coords_2
=
generate_bilinear_data
(
w
,
w_new
)
ratios
,
coords_1
,
coords_2
=
generate_bilinear_data
(
h
,
h_new
)
coords_1
=
coords_1
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
c
,
-
1
,
w_new
))
coords_1
=
coords_1
.
expand
((
n
,
c
,
h_new
,
-
1
))
coords_2
=
coords_2
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
c
,
-
1
,
w_new
))
coords_2
=
coords_2
.
expand
((
n
,
c
,
h_new
,
-
1
))
ratios
=
ratios
.
reshape
((
1
,
1
,
-
1
,
1
)).
expand
((
n
,
1
,
-
1
,
w_new
))
ratios
=
ratios
.
expand
((
n
,
1
,
h_new
,
-
1
))
pass_1
=
einops
.
rearrange
(
result
.
gather
(
-
1
,
coords_1
),
'n c h w -> (n h w) c'
)
pass_1
=
einops
.
rearrange
(
result
.
gather
(
-
2
,
coords_1
),
'n c h w -> (n h w) c'
)
pass_2
=
einops
.
rearrange
(
result
.
gather
(
-
1
,
coords_2
),
'n c h w -> (n h w) c'
)
pass_2
=
einops
.
rearrange
(
result
.
gather
(
-
2
,
coords_2
),
'n c h w -> (n h w) c'
)
ratios
=
einops
.
rearrange
(
ratios
,
'n c h w -> (n h w) c'
)
ratios
=
einops
.
rearrange
(
ratios
,
'n c h w -> (n h w) c'
)
result
=
slerp
(
pass_1
,
pass_2
,
ratios
)
result
=
slerp
(
pass_1
,
pass_2
,
ratios
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment