Skip to content

Updated incorrect docstring and removed redundant logic in sampling.py #4979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions pymc3/distributions/distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,15 @@ def dist(

@singledispatch
def _get_moment(op, rv, size, *rv_inputs) -> TensorVariable:
"""Fallback method for creating an initial value for a random variable.

Parameters are the same as for the `.dist()` method.
"""
return None


def get_moment(rv: TensorVariable) -> TensorVariable:
"""Fallback method for creating an initial value for a random variable.
"""Method for choosing a representative point/value
that can be used to start optimization or MCMC sampling.

Parameters are the same as for the `.dist()` method.
The only parameter to this function is the RandomVariable
for which the value is to be derived.
"""
size = rv.owner.inputs[1]
return _get_moment(rv.owner.op, rv, size, *rv.owner.inputs[3:])
Expand Down
3 changes: 1 addition & 2 deletions pymc3/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import xarray

from aesara.compile.mode import Mode
from aesara.graph.basic import Constant
from aesara.tensor.sharedvar import SharedVariable
from arviz import InferenceData
from fastprogress.fastprogress import progress_bar
Expand Down Expand Up @@ -2002,7 +2001,7 @@ def sample_prior_predictive(
names.append(rv_var.name)
vars_to_sample.append(rv_var)

inputs = [i for i in inputvars(vars_to_sample) if not isinstance(i, (SharedVariable, Constant))]
inputs = [i for i in inputvars(vars_to_sample) if not isinstance(i, SharedVariable)]

sampler_fn = compile_rv_inplace(
inputs, vars_to_sample, allow_input_downcast=True, accept_inplace=True, mode=mode
Expand Down