Skip to content

Commit

Permalink
Changed to union to support p3.9.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitSolomonPrinceton committed Sep 16, 2024
1 parent 00bac06 commit 20fce79
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cvxtorch/torch_expression.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from functools import partial
from typing import Union

import torch
from cvxpy.atoms.affine.add_expr import AddExpression
Expand Down Expand Up @@ -90,7 +91,7 @@ def torch_expression(self):
def variables_dictionary(self):
return self._variables_dictionary

def __init__(self, expr: Expression | Constraint, provided_vars_list:list = [],
def __init__(self, expr: Union[Expression, Constraint], provided_vars_list:list = [],
implemented_only: bool=True, dtype: torch.dtype = torch.float64):
self.implemented_only = implemented_only
self._torch_expression, self._variables_dictionary = self._gen_torch_exp(expr=expr,
Expand Down

0 comments on commit 20fce79

Please sign in to comment.