def __init__(self, in1, in2, debug=False): """ Instantiates a trace object, and builds the exact execution pipeline for adding the given parameters. """ self.in1, self.in2, self.debug = in1, in2, debug self.trace, self.scratch = [], ScratchPad(in1, in2, CONFIG["ENVIRONMENT_ROW"], CONFIG["ENVIRONMENT_COL"]) # Build Execution Trace self.build() # Check answer true_ans = self.in1 + self.in2 trace_ans = int("".join(map(str, map(int, self.scratch[3])))) assert(true_ans == trace_ans)
ax2.set_facecolor((0.0, 0.0, 0.0)) pix_range = np.max(arr) - np.min(arr) ax2.imshow((arr - np.min(arr)) / (pix_range + 1e-6), vmin=0, vmax=1) else: fig = plt.figure() fig.canvas.set_window_title(title) ax = fig.add_subplot("111") ax.set_facecolor((0.0, 0.0, 0.0)) ax.imshow(array) pad_size = (1023, 1001) if __name__ == "__main__": set_omp_max_threads(4) p = ScratchPad() p.load_brush(get_brushes()[0]) p.reset_pad(*pad_size, 1) assert p.get_brush_num() == 1 assert p.get_pad_size() == pad_size assert p.get_layer_num() == 1 p.set_opacity(0, 1.0) p.add_layer() p.pop_layer(1) assert p.get_layer_num() == 1 # draw rectangle, only works when dtime is set to max points = [ Point(0.3, 0.3), Point(0.3, 0.6), Point(0.6, 0.6),