Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
a88a169
1
Parent(s):
9c31a35
Remove unused torch backwards to sympy
Browse files- pysr/export_torch.py +0 -24
pysr/export_torch.py
CHANGED
@@ -121,30 +121,6 @@ def _initialize_torch():
|
|
121 |
args.append(arg_)
|
122 |
self._args = torch.nn.ModuleList(args)
|
123 |
|
124 |
-
def sympy(self, _memodict):
|
125 |
-
if issubclass(self._sympy_func, sympy.Float):
|
126 |
-
return self._sympy_func(self._value.item())
|
127 |
-
elif issubclass(self._sympy_func, sympy.UnevaluatedExpr):
|
128 |
-
return self._sympy_func(self._value.item())
|
129 |
-
elif issubclass(self._sympy_func, sympy.Integer):
|
130 |
-
return self._sympy_func(self._value)
|
131 |
-
elif issubclass(self._sympy_func, sympy.Symbol):
|
132 |
-
return self._sympy_func(self._name)
|
133 |
-
else:
|
134 |
-
if issubclass(self._sympy_func, (sympy.Min, sympy.Max)):
|
135 |
-
evaluate = False
|
136 |
-
else:
|
137 |
-
evaluate = True
|
138 |
-
args = []
|
139 |
-
for arg in self._args:
|
140 |
-
try:
|
141 |
-
arg_ = _memodict[arg]
|
142 |
-
except KeyError:
|
143 |
-
arg_ = arg.sympy(_memodict)
|
144 |
-
_memodict[arg] = arg_
|
145 |
-
args.append(arg_)
|
146 |
-
return self._sympy_func(*args, evaluate=evaluate)
|
147 |
-
|
148 |
def forward(self, memodict):
|
149 |
args = []
|
150 |
for arg in self._args:
|
|
|
121 |
args.append(arg_)
|
122 |
self._args = torch.nn.ModuleList(args)
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
def forward(self, memodict):
|
125 |
args = []
|
126 |
for arg in self._args:
|