Skip to content

Bayesian neural network notebook does not work  #504

Closed
@earlbellinger

Description

@earlbellinger

Notebook title: Variational Inference: Bayesian Neural Networks
Notebook url: https://github.com/pymc-devs/pymc-examples/blob/main/examples/variational_inference/bayesian_neural_network_advi.ipynb

Issue description

Cell 14:

    pm.set_data(new_data={"ann_input": grid_2d, "ann_output": dummy_out})
    ppc = pm.sample_posterior_predictive(trace)

yields

ValueError: size does not match the broadcast shape of the parameters. (100,), (100,), (10000,)
Apply node that caused the error: bernoulli_rv{0, (0,), int64, True}(RandomGeneratorSharedVariable(<Generator(PCG64) at 0x7F779E3502E0>), MakeVector{dtype='int64'}.0, TensorConstant{4}, Elemwise{Sigmoid}[(0, 0)].0)
Toposort index: 10
Inputs types: [RandomGeneratorType, TensorType(int64, (1,)), TensorType(int64, ()), TensorType(float64, (?,))]
Inputs shapes: ['No shapes', (1,), (), (10000,)]
Inputs strides: ['No strides', (8,), (), (8,)]
Inputs values: [Generator(PCG64) at 0x7F779E3502E0, array([100]), array(4), 'not shown']
Outputs clients: [['output'], ['output']]

Expected output

 100.00% [5000/5000 00:30<00:00]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions