Skip to content
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

How Can i Implement “for each”、“if”,“swich” function with block #34

Open
dyingstraw opened this issue May 15, 2024 · 2 comments

Comments

@dyingstraw
Copy link

No description provided.

@dyingstraw dyingstraw changed the title HOW How Can i Implement “for each”、“if”,“swich” function with block May 15, 2024
@dyingstraw
Copy link
Author

dyingstraw commented May 15, 2024

I just Implement for each just belows,but it does not work。
image

just like execute first set_interface here.

for_block = Block(name='For')
for_block.add_input(name="for_array")
for_block.add_output(name="for_out")
for_block.add_output(name="for_index")
for_block.add_output(name="for_final")
def foreach_fn(self):
    array = self.get_interface("for_array")
    print("enter for:{}",array)
    for index,item in enumerate(array):
        print("enter for item:{}",item)
        **self.set_interface(name="for_out",value=item)** # just here
        self.set_interface(name="for_inex",value=index)
    self.set_interface(name="for_final",value=None)

for_block.add_compute(foreach_fn)

Maybe I can modify the ComputeEngine?

@krish-adi
Copy link
Owner

do you want to add a switch statement as a block?

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

No branches or pull requests

2 participants