Skip to content

Commit 4878fdc

Browse files
williambdeanricardoV94
authored andcommitted
remove mutable=True. closes #7367
1 parent 7d913ce commit 4878fdc

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

pymc/model/core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,8 @@ def set_data(
11711171
raise ShapeError(
11721172
f"Resizing dimension '{dname}' is impossible, because "
11731173
"a `TensorConstant` stores its length. To be able "
1174-
"to change the dimension length, pass `mutable=True` when "
1175-
"registering the dimension via `model.add_coord`, "
1176-
"or define it via a `pm.MutableData` variable."
1174+
"to change the dimension length, create data with "
1175+
"pm.Data() instead."
11771176
)
11781177
elif length_tensor.owner is not None:
11791178
# The dimension was created from another variable:

tests/model/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ def test_set_data_indirect_resize_without_coords(self):
928928

929929
def test_set_data_indirect_resize_with_coords(self):
930930
with pm.Model() as pmodel:
931-
pmodel.add_coord("mdim", ["A", "B"], mutable=True, length=2)
931+
pmodel.add_coord("mdim", ["A", "B"], length=2)
932932
pm.Data("mdata", [1, 2], dims="mdim")
933933

934934
assert pmodel.coords["mdim"] == ("A", "B")

tests/sampling/test_forward.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ def test_mutable_coords_volatile(self):
342342
rng = np.random.default_rng(seed=42)
343343
data = rng.normal(loc=1, scale=0.2, size=(10, 3))
344344
with pm.Model() as model:
345-
model.add_coord("name", ["A", "B", "C"], mutable=True)
346-
model.add_coord("obs", list(range(10, 20)), mutable=True)
345+
model.add_coord("name", ["A", "B", "C"])
346+
model.add_coord("obs", list(range(10, 20)))
347347
offsets = pm.Data("offsets", rng.normal(0, 1, size=(10,)))
348348
a = pm.Normal("a", mu=0, sigma=1, dims=["name"])
349349
b = pm.Normal("b", mu=offsets, sigma=1)
@@ -873,8 +873,8 @@ def make_mock_model():
873873
rng = np.random.default_rng(seed=42)
874874
data = rng.normal(loc=1, scale=0.2, size=(10, 3))
875875
with pm.Model() as model:
876-
model.add_coord("name", ["A", "B", "C"], mutable=True)
877-
model.add_coord("obs", list(range(10, 20)), mutable=True)
876+
model.add_coord("name", ["A", "B", "C"])
877+
model.add_coord("obs", list(range(10, 20)))
878878
offsets = pm.Data("offsets", rng.normal(0, 1, size=(10,)))
879879
a = pm.Normal("a", mu=0, sigma=1, dims=["name"])
880880
b = pm.Normal("b", mu=offsets, sigma=1)

0 commit comments

Comments
 (0)