def __init__(self, model, lr, n_primitives, canvas_size, w_surface, w_alignment, csg, rounded, cuda=True):
    self.model = model
    self.cuda = cuda
    self.n_primitives = n_primitives
    self.canvas_size = canvas_size
    self.w_surface = w_surface
    self.w_alignment = w_alignment
    self.csg = csg
    self.rounded = rounded
    self._step = 0
    if self.cuda:
        self.model.cuda()
    self.optimizer = th.optim.Adam(self.model.parameters(), lr=lr)
def __init__(self, model, lr, n_primitives, canvas_size, w_surface, w_alignment, csg, rounded, cuda=True):
    self.model = model
    self.cuda = cuda
    self.n_primitives = n_primitives
    self.canvas_size = canvas_size
    self.w_surface = w_surface
    self.w_alignment = w_alignment
    self.csg = csg
    self.rounded = rounded
    self._step = 0
    if self.cuda:
        self.model.cuda()
    self.optimizer = th.optim.Adam(self.model.parameters(), lr=lr)