Skip to content

Commit 2b06fa1

Browse files
brandonwillardtwiecki
authored andcommitted
Use np.shape instead of var.shape in theano.tensor.basic.get_scalar_constant_value
1 parent 7736732 commit 2b06fa1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

theano/tensor/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def get_scalar_constant_value(
440440
i = v.owner.op.i
441441
inp = v.owner.inputs[0]
442442
if isinstance(inp, Constant):
443-
return np.asarray(inp.data.shape[i])
443+
return np.asarray(np.shape(inp.data)[i])
444444
# The shape of a broadcastable dimension is 1
445445
if hasattr(inp.type, "broadcastable") and inp.type.broadcastable[i]:
446446
return np.asarray(1)
@@ -638,7 +638,7 @@ def get_scalar_constant_value(
638638
return np.asarray(1)
639639

640640
if isinstance(grandparent, Constant):
641-
return np.asarray(grandparent.data.shape[idx])
641+
return np.asarray(np.shape(grandparent.data)[idx])
642642

643643
raise NotScalarConstantError(v)
644644

0 commit comments

Comments
 (0)