Skip to content

Commit 2b9e465

Browse files
aseyboldtmichaelosthege
authored andcommitted
Improve error message for missing get_moment implementations
1 parent 37ba9a3 commit 2b9e465

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pymc/distributions/distribution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def dist(
351351

352352
@singledispatch
353353
def _get_moment(op, rv, size, *rv_inputs) -> TensorVariable:
354-
return None
354+
raise NotImplementedError(
355+
f"Random variable {rv} of type {op} has no get_moment implementation."
356+
)
355357

356358

357359
def get_moment(rv: TensorVariable) -> TensorVariable:

0 commit comments

Comments
 (0)