Runs the operator on a given input. Also visualizes the output if visualization was set to True. :param input: The input tensor to run the operator on. :returns: True if the operator executed successfully, False otherwise.
(self, input)
| 72 | self.setup(self.input) |
| 73 | |
| 74 | def __call__(self, input): |
| 75 | """ |
| 76 | Runs the operator on a given input. Also visualizes the output if visualization was set to True. |
| 77 | :param input: The input tensor to run the operator on. |
| 78 | :returns: True if the operator executed successfully, False otherwise. |
| 79 | """ |
| 80 | try: |
| 81 | self.op_output = self.run(input) |
| 82 | |
| 83 | if self.should_visualize and self.output_dir: |
| 84 | self.visualize() |
| 85 | |
| 86 | return True |
| 87 | except Exception as e: |
| 88 | logger.error( |
| 89 | "Unable to run the op %s due to error: %s" |
| 90 | % (self.__class__.__name__, str(e)) |
| 91 | ) |
| 92 | return False |
| 93 | |
| 94 | @abstractmethod |
| 95 | def setup(self, input): |