Skip to content

Commit fd6ddde

Browse files
committed
Add bool check for base_var and use pytensor invert Op on value variable
1 parent 9c077d5 commit fd6ddde

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pymc/logprob/binary.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ def find_measurable_bitwise(fgraph: FunctionGraph, node: Node) -> Optional[List[
161161
):
162162
return None
163163

164+
if not base_var.dtype.startswith("bool"):
165+
raise None
166+
164167
# Make base_var unmeasurable
165168
unmeasurable_base_var = ignore_logprob(base_var)
166169

@@ -184,6 +187,6 @@ def find_measurable_bitwise(fgraph: FunctionGraph, node: Node) -> Optional[List[
184187
def bitwise_not_logprob(op, values, base_rv, **kwargs):
185188
(value,) = values
186189

187-
logprob = _logprob_helper(base_rv, np.bitwise_not(value), **kwargs)
190+
logprob = _logprob_helper(base_rv, invert(value), **kwargs)
188191

189192
return logprob

0 commit comments

Comments
 (0)