Skip to content

Commit 4597d32

Browse files
Upgraded sympy to v1.8. (#591)
* Upgraded sympy to v1.8. * format.
1 parent 19dbae5 commit 4597d32

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

release/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def finalize_options(self):
5151

5252

5353
REQUIRED_PACKAGES = [
54-
'cirq == 0.11.0', 'sympy == 1.5', 'googleapis-common-protos==1.52.0',
54+
'cirq == 0.11.0', 'sympy == 1.8', 'googleapis-common-protos==1.52.0',
5555
'google-api-core==1.21.0', 'google-auth==1.18.0', 'protobuf==3.13.0'
5656
]
5757

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cirq==0.11.0
2-
sympy==1.5
2+
sympy==1.8
33
nbconvert==5.6.1
44
nbformat==4.4.0
55
pylint==2.4.4

tensorflow_quantum/core/serialize/serializer.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,18 @@ def _scalar_extractor(x):
6060
return 1.0
6161

6262
expr = x.evalf()
63-
if isinstance(expr, sympy.mul.Mul):
63+
if isinstance(expr, sympy.core.Mul):
6464
lhs_eval, rhs_eval = _parse_mul(expr)
6565

6666
if isinstance(lhs_eval, sympy.Symbol) and isinstance(
67-
rhs_eval, (sympy.numbers.Float, sympy.numbers.Integer)):
67+
rhs_eval,
68+
(sympy.core.numbers.Float, sympy.core.numbers.Integer)):
6869
# lhs contains symbol rhs contains number.
6970
return _round(float(rhs_eval))
7071

7172
if isinstance(rhs_eval, sympy.Symbol) and isinstance(
72-
lhs_eval, (sympy.numbers.Float, sympy.numbers.Integer)):
73+
lhs_eval,
74+
(sympy.core.numbers.Float, sympy.core.numbers.Integer)):
7375
# lhs contains number.
7476
return _round(float(lhs_eval))
7577

@@ -90,16 +92,18 @@ def _symbol_extractor(x):
9092
return x
9193

9294
expr = x.evalf()
93-
if isinstance(expr, sympy.mul.Mul):
95+
if isinstance(expr, sympy.core.Mul):
9496
lhs_eval, rhs_eval = _parse_mul(expr)
9597

9698
if isinstance(lhs_eval, sympy.Symbol) and isinstance(
97-
rhs_eval, (sympy.numbers.Float, sympy.numbers.Integer)):
99+
rhs_eval,
100+
(sympy.core.numbers.Float, sympy.core.numbers.Integer)):
98101
# lhs contains symbol rhs contains number.
99102
return lhs_eval
100103

101104
if isinstance(rhs_eval, sympy.Symbol) and isinstance(
102-
lhs_eval, (sympy.numbers.Float, sympy.numbers.Integer)):
105+
lhs_eval,
106+
(sympy.core.numbers.Float, sympy.core.numbers.Integer)):
103107
# lhs contains number.
104108
return rhs_eval
105109

0 commit comments

Comments
 (0)