@@ -1179,16 +1179,17 @@ def set_data(
1179
1179
# Reject resizing if we already know that it would create shape problems.
1180
1180
# NOTE: If there are multiple pm.MutableData containers sharing this dim, but the user only
1181
1181
# changes the values for one of them, they will run into shape problems nonetheless.
1182
- length_belongs_to = length_tensor .owner .inputs [0 ].owner .inputs [0 ]
1183
- if not isinstance (length_belongs_to , SharedVariable ) and length_changed :
1184
- raise ShapeError (
1185
- f"Resizing dimension '{ dname } ' with values of length { new_length } would lead to incompatibilities, "
1186
- f"because the dimension was initialized from '{ length_belongs_to } ' which is not a shared variable. "
1187
- f"Check if the dimension was defined implicitly before the shared variable '{ name } ' was created, "
1188
- f"for example by a model variable." ,
1189
- actual = new_length ,
1190
- expected = old_length ,
1191
- )
1182
+ if original_coords is None :
1183
+ length_belongs_to = length_tensor .owner .inputs [0 ].owner .inputs [0 ]
1184
+ if not isinstance (length_belongs_to , SharedVariable ) and length_changed :
1185
+ raise ShapeError (
1186
+ f"Resizing dimension '{ dname } ' with values of length { new_length } would lead to incompatibilities, "
1187
+ f"because the dimension was initialized from '{ length_belongs_to } ' which is not a shared variable. "
1188
+ f"Check if the dimension was defined implicitly before the shared variable '{ name } ' was created, "
1189
+ f"for example by a model variable." ,
1190
+ actual = new_length ,
1191
+ expected = old_length ,
1192
+ )
1192
1193
if original_coords is not None and length_changed :
1193
1194
if length_changed and new_coords is None :
1194
1195
raise ValueError (
0 commit comments