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
6781b181
"...git@developer.sourcefind.cn:wangsen/paddle_dbnet.git" did not exist on "864af3db34ad271670d46e4cdb2ddbebe429a6a6"
Commit
6781b181
authored
Dec 21, 2023
by
comfyanonymous
Browse files
Fix potential tensor device issue with ImageCompositeMasked.
parent
a1e1c69f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
comfy_extras/nodes_mask.py
comfy_extras/nodes_mask.py
+2
-1
No files found.
comfy_extras/nodes_mask.py
View file @
6781b181
...
@@ -6,6 +6,7 @@ import comfy.utils
...
@@ -6,6 +6,7 @@ import comfy.utils
from
nodes
import
MAX_RESOLUTION
from
nodes
import
MAX_RESOLUTION
def
composite
(
destination
,
source
,
x
,
y
,
mask
=
None
,
multiplier
=
8
,
resize_source
=
False
):
def
composite
(
destination
,
source
,
x
,
y
,
mask
=
None
,
multiplier
=
8
,
resize_source
=
False
):
source
=
source
.
to
(
destination
.
device
)
if
resize_source
:
if
resize_source
:
source
=
torch
.
nn
.
functional
.
interpolate
(
source
,
size
=
(
destination
.
shape
[
2
],
destination
.
shape
[
3
]),
mode
=
"bilinear"
)
source
=
torch
.
nn
.
functional
.
interpolate
(
source
,
size
=
(
destination
.
shape
[
2
],
destination
.
shape
[
3
]),
mode
=
"bilinear"
)
...
@@ -20,7 +21,7 @@ def composite(destination, source, x, y, mask = None, multiplier = 8, resize_sou
...
@@ -20,7 +21,7 @@ def composite(destination, source, x, y, mask = None, multiplier = 8, resize_sou
if
mask
is
None
:
if
mask
is
None
:
mask
=
torch
.
ones_like
(
source
)
mask
=
torch
.
ones_like
(
source
)
else
:
else
:
mask
=
mask
.
clone
(
)
mask
=
mask
.
to
(
destination
.
device
,
copy
=
True
)
mask
=
torch
.
nn
.
functional
.
interpolate
(
mask
.
reshape
((
-
1
,
1
,
mask
.
shape
[
-
2
],
mask
.
shape
[
-
1
])),
size
=
(
source
.
shape
[
2
],
source
.
shape
[
3
]),
mode
=
"bilinear"
)
mask
=
torch
.
nn
.
functional
.
interpolate
(
mask
.
reshape
((
-
1
,
1
,
mask
.
shape
[
-
2
],
mask
.
shape
[
-
1
])),
size
=
(
source
.
shape
[
2
],
source
.
shape
[
3
]),
mode
=
"bilinear"
)
mask
=
comfy
.
utils
.
repeat_to_batch_size
(
mask
,
source
.
shape
[
0
])
mask
=
comfy
.
utils
.
repeat_to_batch_size
(
mask
,
source
.
shape
[
0
])
...
...
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