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
f8f165e2
Commit
f8f165e2
authored
Jan 31, 2023
by
comfyanonymous
Browse files
Add a LatentRotate node.
parent
1daccf36
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
nodes.py
nodes.py
+24
-0
No files found.
nodes.py
View file @
f8f165e2
...
@@ -198,6 +198,29 @@ class LatentUpscale:
...
@@ -198,6 +198,29 @@ class LatentUpscale:
s
=
torch
.
nn
.
functional
.
interpolate
(
s
,
size
=
(
height
//
8
,
width
//
8
),
mode
=
upscale_method
)
s
=
torch
.
nn
.
functional
.
interpolate
(
s
,
size
=
(
height
//
8
,
width
//
8
),
mode
=
upscale_method
)
return
(
s
,)
return
(
s
,)
class
LatentRotate
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"samples"
:
(
"LATENT"
,),
"rotation"
:
([
"none"
,
"90 degrees"
,
"180 degrees"
,
"270 degrees"
],),
}}
RETURN_TYPES
=
(
"LATENT"
,)
FUNCTION
=
"rotate"
CATEGORY
=
"latent"
def
rotate
(
self
,
samples
,
rotation
):
s
=
samples
.
clone
()
rotate_by
=
0
if
rotation
.
startswith
(
"90"
):
rotate_by
=
1
elif
rotation
.
startswith
(
"180"
):
rotate_by
=
2
elif
rotation
.
startswith
(
"270"
):
rotate_by
=
3
s
=
torch
.
rot90
(
samples
,
k
=
rotate_by
,
dims
=
[
3
,
2
])
return
(
s
,)
class
KSampler
:
class
KSampler
:
def
__init__
(
self
,
device
=
"cuda"
):
def
__init__
(
self
,
device
=
"cuda"
):
self
.
device
=
device
self
.
device
=
device
...
@@ -342,6 +365,7 @@ NODE_CLASS_MAPPINGS = {
...
@@ -342,6 +365,7 @@ NODE_CLASS_MAPPINGS = {
"LoadImage"
:
LoadImage
,
"LoadImage"
:
LoadImage
,
"ConditioningCombine"
:
ConditioningCombine
,
"ConditioningCombine"
:
ConditioningCombine
,
"ConditioningSetArea"
:
ConditioningSetArea
,
"ConditioningSetArea"
:
ConditioningSetArea
,
"LatentRotate"
:
LatentRotate
,
}
}
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