Skip to content

Commit eb19200

Browse files
committed
deprecate tests that depend on the value setter
1 parent 7ee657b commit eb19200

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

doc/library/compile/io.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ To show some examples of these access methods...
189189
>>> fn = function([a, b, ((c, c+a+b), 10.0)], [])
190190

191191
>>> # the value associated with c is accessible in 3 ways
192-
>>> fn['s'] is fn.value[c]
192+
>>> fn['s'] is fn.data[c]
193193
True
194-
>>> fn['s'] is fn.container[c].value
194+
>>> fn['s'] is fn.container[c].data
195195
True
196196

197197
>>> fn['s']
@@ -205,14 +205,14 @@ array(13.0)
205205
[]
206206
>>> fn['s']
207207
array(100.0)
208-
>>> fn.value[c] = 99.0
208+
>>> fn.data[c] = 99.0
209209
>>> fn(1,0)
210210
[]
211211
>>> fn['s']
212212
array(100.0)
213-
>>> fn['s'] == fn.value[c]
213+
>>> fn['s'] == fn.data[c]
214214
True
215-
>>> fn['s'] == fn.container[c].value
215+
>>> fn['s'] == fn.container[c].data
216216
True
217217

218218

doc/library/tensor/basic.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ precise) is by calling :func:`pytensor.shared`
287287

288288
x = pytensor.shared(np.random.standard_normal((3, 4)))
289289

290-
This will return a :term:`shared variable <shared variable>` whose ``.value`` is
290+
This will return a :term:`shared variable <shared variable>` whose ``.data`` is
291291
a NumPy `ndarray`. The number of dimensions and dtype of the `Variable` are
292292
inferred from the `ndarray` argument. The argument to `shared` *will not be
293-
copied*, and subsequent changes will be reflected in ``x.value``.
293+
copied*, and subsequent changes will be reflected in ``x.data``.
294294

295295
For additional information, see the :func:`shared() <shared.shared>` documentation.
296296

pytensor/compile/function/types.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ def __init__(
508508
# there is no need to refeed the default value.
509509
assert not refeed
510510
else:
511-
c.value = value
511+
c.data = value
512512
c.required = required
513513
c.implicit = input.implicit
514514
# this is a count of how many times the input has been
@@ -531,7 +531,7 @@ def __init__(
531531
self.inv_finder = inv_finder
532532

533533
# this class is important in overriding the square-bracket notation:
534-
# fn.value[x]
534+
# fn.data[x]
535535
# self reference is available via the closure on the class
536536
class ValueAttribute:
537537
def __getitem__(self, item):
@@ -546,7 +546,7 @@ def __getitem__(self, item):
546546
"for duplicates."
547547
)
548548
if isinstance(s, Container):
549-
return s.value
549+
return s.data
550550
else:
551551
raise NotImplementedError
552552

@@ -564,7 +564,7 @@ def __setitem__(self, item, value):
564564
"for duplicates."
565565
)
566566
if isinstance(s, Container):
567-
s.value = value
567+
s.data = value
568568
s.provided += 1
569569
else:
570570
s(value)
@@ -1624,11 +1624,11 @@ def __init__(
16241624
self.name = name
16251625
self.trust_input = trust_input
16261626

1627-
self.required = [(i.value is None) for i in self.inputs]
1627+
self.required = [(i.data is None) for i in self.inputs]
16281628
self.refeed = [
16291629
(
1630-
i.value is not None
1631-
and not isinstance(i.value, Container)
1630+
i.data is not None
1631+
and not isinstance(i.data, Container)
16321632
and i.update is None
16331633
)
16341634
for i in self.inputs
@@ -1898,10 +1898,10 @@ def convert_function_input(input):
18981898
if len(input) == 1:
18991899
return input[0]
19001900
elif len(input) == 2:
1901-
input, value = input
1901+
input, data = input
19021902
if name is not None:
19031903
input.name = name
1904-
input.value = value
1904+
input.data = data
19051905
return input
19061906
else:
19071907
raise TypeError(f"The input specification is not valid: {input}")

pytensor/link/numba/dispatch/sparse.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ def unbox_matrix(typ, obj, c):
108108
indptr = c.pyapi.object_getattr_string(obj, "indptr")
109109
shape = c.pyapi.object_getattr_string(obj, "shape")
110110

111-
struct_ptr.data = c.unbox(typ.data, data).value
112-
struct_ptr.indices = c.unbox(typ.indices, indices).value
113-
struct_ptr.indptr = c.unbox(typ.indptr, indptr).value
114-
struct_ptr.shape = c.unbox(typ.shape, shape).value
111+
struct_ptr.data = c.unbox(typ.data, data).data
112+
struct_ptr.indices = c.unbox(typ.indices, indices).data
113+
struct_ptr.indptr = c.unbox(typ.indptr, indptr).data
114+
struct_ptr.shape = c.unbox(typ.shape, shape).data
115115

116116
c.pyapi.decref(data)
117117
c.pyapi.decref(indices)

pytensor/scan/rewriting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,7 +1442,7 @@ def scan_save_mem(fgraph, node):
14421442
if (
14431443
i <= op.info.n_mit_mot
14441444
and isinstance(this_slice[0], ScalarConstant)
1445-
and this_slice[0].value == -1
1445+
and this_slice[0].data == -1
14461446
):
14471447
start = nw_steps - 1
14481448
else:
@@ -1728,7 +1728,7 @@ def scan_save_mem(fgraph, node):
17281728
# Special case when only last value is requested
17291729
if (
17301730
isinstance(old_slices[0], ScalarConstant)
1731-
and old_slices[0].value == -1
1731+
and old_slices[0].data == -1
17321732
):
17331733
position = old_slices[0]
17341734
else:

pytensor/tensor/rewriting/math.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2016,7 +2016,7 @@ def local_mul_to_sqr(fgraph, node):
20162016
@node_rewriter([int_div])
20172017
def local_intdiv_by_one(fgraph, node):
20182018
"""x // 1 -> x"""
2019-
if isinstance(node.inputs[1], TensorConstant) and np.all(node.inputs[1].value == 1):
2019+
if isinstance(node.inputs[1], TensorConstant) and np.all(node.inputs[1].data == 1):
20202020
return [node.inputs[0].astype(node.outputs[0].dtype)]
20212021

20222022

0 commit comments

Comments
 (0)