Skip to content

Add Compare & Conditional node #2866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 18, 2024

Conversation

RunDevelopment
Copy link
Member

@RunDevelopment RunDevelopment commented May 18, 2024

This PR adds 2 new nodes: Compare and Conditional.

Compare is a simple node that takes 2 numbers and returns either ==, !=, <, <=, >, >=. The result of this node will be a boolean. This is currently the only node that can produce boolean values that can be connected other nodes.

Condition is the node equivalent of return a if cond else b. The node only evaluates the input that is actually returned, so we don't perform unnecessary computation. This is done with lazy inputs added in #2808. Pass through is supported by passing through the "If true" value.

Other changes:

  • Added BoolOutput for returning boolean values.
  • Added has_handle: bool parameter to BoolInput. This currently switches between the old enum/dropdown based implementation and a new generic-input based implemented. We should improve this in the future, but it works for now.
  • Added type tags for the bool type.

Fixes #2671

Not that this does not solve the issue #148. #148 describes a more general branching implementation that is more powerful than the one implemented here.

image
image
image

joeyballentine
joeyballentine previously approved these changes May 18, 2024
Copy link
Member

@joeyballentine joeyballentine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Genius implementation

@joeyballentine
Copy link
Member

That's what i get for using github's merge resolver instead of doing it locally...

@RunDevelopment
Copy link
Member Author

No worries. I fixed it.

@joeyballentine joeyballentine merged commit a3e33f4 into chaiNNer-org:main May 18, 2024
@RunDevelopment RunDevelopment deleted the compare-conditional branch May 18, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logical flow control / image size output
2 participants