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
3fa009f4
"doc/vscode:/vscode.git/clone" did not exist on "4f8b511315757bca776433959e55a531506320df"
Commit
3fa009f4
authored
Jan 31, 2023
by
comfyanonymous
Browse files
Add a LatentFlip node.
parent
69df7eba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
nodes.py
nodes.py
+22
-1
No files found.
nodes.py
View file @
3fa009f4
...
...
@@ -210,7 +210,6 @@ class LatentRotate:
CATEGORY
=
"latent"
def
rotate
(
self
,
samples
,
rotation
):
s
=
samples
.
clone
()
rotate_by
=
0
if
rotation
.
startswith
(
"90"
):
rotate_by
=
1
...
...
@@ -221,6 +220,27 @@ class LatentRotate:
s
=
torch
.
rot90
(
samples
,
k
=
rotate_by
,
dims
=
[
3
,
2
])
return
(
s
,)
class
LatentFlip
:
@
classmethod
def
INPUT_TYPES
(
s
):
return
{
"required"
:
{
"samples"
:
(
"LATENT"
,),
"flip_method"
:
([
"x-axis: vertically"
,
"y-axis: horizontally"
],),
}}
RETURN_TYPES
=
(
"LATENT"
,)
FUNCTION
=
"flip"
CATEGORY
=
"latent"
def
flip
(
self
,
samples
,
flip_method
):
if
flip_method
.
startswith
(
"x"
):
s
=
torch
.
flip
(
samples
,
dims
=
[
2
])
elif
flip_method
.
startswith
(
"y"
):
s
=
torch
.
flip
(
samples
,
dims
=
[
3
])
else
:
s
=
samples
return
(
s
,)
def
common_ksampler
(
device
,
model
,
seed
,
steps
,
cfg
,
sampler_name
,
scheduler
,
positive
,
negative
,
latent_image
,
denoise
=
1.0
,
disable_noise
=
False
,
start_step
=
None
,
last_step
=
None
,
force_full_denoise
=
False
):
if
disable_noise
:
noise
=
torch
.
zeros
(
latent_image
.
size
(),
dtype
=
latent_image
.
dtype
,
layout
=
latent_image
.
layout
,
device
=
"cpu"
)
...
...
@@ -409,6 +429,7 @@ NODE_CLASS_MAPPINGS = {
"ConditioningSetArea"
:
ConditioningSetArea
,
"KSamplerAdvanced"
:
KSamplerAdvanced
,
"LatentRotate"
:
LatentRotate
,
"LatentFlip"
:
LatentFlip
,
}
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