Initializes a new instances of this class. :param device_id: The GPU device id that to use by this operator. :param input: The input tensor to run the operator on. :param output_dir: The directory where artifacts should be stored. :param should_visualize: A f
(self, device_id, input, output_dir=None, should_visualize=False)
| 49 | """ |
| 50 | |
| 51 | def __init__(self, device_id, input, output_dir=None, should_visualize=False): |
| 52 | """ |
| 53 | Initializes a new instances of this class. |
| 54 | :param device_id: The GPU device id that to use by this operator. |
| 55 | :param input: The input tensor to run the operator on. |
| 56 | :param output_dir: The directory where artifacts should be stored. |
| 57 | :param should_visualize: A flag specifying whether the output from the operator |
| 58 | should be visualized and written to the disk or not. |
| 59 | """ |
| 60 | self.device_id = device_id |
| 61 | self.input = input |
| 62 | self.output_dir = output_dir |
| 63 | self.should_visualize = should_visualize |
| 64 | if self.output_dir: |
| 65 | if not os.path.isdir(self.output_dir): |
| 66 | raise ValueError("A valid output_dir must be given.") |
| 67 | self.op_output = None |
| 68 | |
| 69 | self.assets_dir = os.path.join( |
| 70 | Path(os.path.abspath(__file__)).parents[0], "assets" |
| 71 | ) |
| 72 | self.setup(self.input) |
| 73 | |
| 74 | def __call__(self, input): |
| 75 | """ |