Skip to content

Commit 1ee6df1

Browse files
committed
Throw an exception if there is an explicit shape argument.
1 parent ad2b486 commit 1ee6df1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

com.ibm.wala.cast.python.ml/source/com/ibm/wala/cast/python/ml/client/PythonTensorAnalysisEngine.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,18 @@ private Set<TensorType> getTensorType(
10181018
throw new IllegalStateException(
10191019
"Expected a " + ConstantKey.class + " for value, but got: " + valueIK + ".");
10201020

1021-
// TODO: Shapes can also be specified as an explicit argument.
1021+
// Shapes can also be specified as an explicit argument. Here, we examine the third explicit
1022+
// argument (recall that the first argument is implicit and corresponds to the called
1023+
// function's name).
1024+
PointerKey shapePK = pointerAnalysis.getHeapModel().getPointerKeyForLocal(node, 4);
1025+
OrdinalSet<InstanceKey> shapePointsToSet = pointerAnalysis.getPointsToSet(shapePK);
1026+
1027+
for (InstanceKey shapeIK : shapePointsToSet)
1028+
// TODO: This is the above case.
1029+
throw new IllegalStateException(
1030+
"Found explicit shape argument: "
1031+
+ shapeIK
1032+
+ ". Currently cannot handle explicit shapes for constant().");
10221033

10231034
// The dtype is the second explicit argument.
10241035
// FIXME: Handle keyword arguments.

0 commit comments

Comments
 (0)