Hi, I want to add a certain number of 0s to the input, but I don??t know the specific number of 0s. I wrote a python block to complete this work, but I don??t seem to understand how the Python block works, which causes it to not work properly. code show as below:
class... self.k = k self.total = 0 def work(self, input_items, output_items): in0 = input_items[0] out = output_items[0] in0_len = len(in0) self.total = self.total + in0_len i = 0 while i<in0_len: out[i] = in0[i] i=i+1 if in0_len < len(output_items[0]):#I found that this sentence does not work. My previous understanding is that each "input_items" and "output_items" has a fixed value (4096). I need to determine that the input item has ended, and then enter the following operation remainder1 = self.total % self.k if remainder1 != 0: while True: out = np.append(out, 0) self.total =self.total+1 remainder2 = self.total % self.k i = i+1 if i==len(output_items[0]) or remainder2==0: break return len(output_items[0]) I think my problem is that this is a synchronized block, the number of input and output is the same, so it is never possible to enter the "if" statement, but I don't know what mechanism should I use to make the number of input and output inconsistent, "interpolation block "The output is a multiple of the input, and it cannot be used by me. How can I solve this problem, thank you in advance?? Best Regards, linge93