# Buggy code
def _update_start_vals(a, b, model):
    """Update a with b, without overwriting existing keys. Values specified for
    transformed variables on the original scale are also transformed and inserted.
    """
    for name in a:
        for tname in b:
            if is_transformed_name(tname) and get_untransformed_name(tname) == name:
                transform_func = [
                    d.transformation for d in model.deterministics if d.name == name
                ]
                if transform_func:
                    b[tname] = transform_func[0].forward(a[name]).eval()

    a.update({k: v for k, v in b.items() if k not in a})


# Traceback (MissingInputError)
Traceback (most recent call last):

File "<ipython-input-1-e7f2b743f1a1>", line 5, in <module>
pm.sample(1000)

File "/usr/local/lib/python3.5/dist-packages/pymc3/sampling.py", line 273, in sample
return sample_func(**sample_args)[discard:]

File "/usr/local/lib/python3.5/dist-packages/pymc3/sampling.py", line 288, in _sample
for it, strace in enumerate(sampling):

File "/usr/local/lib/python3.5/dist-packages/tqdm/_tqdm.py", line 862, in __iter__
for obj in iterable:

File "/usr/local/lib/python3.5/dist-packages/pymc3/sampling.py", line 367, in _iter_sample
_update_start_vals(start, model.test_point, model)

File "/usr/local/lib/python3.5/dist-packages/pymc3/sampling.py", line 483, in _update_start_vals
b[tname] = transform_func[0].forward(a[name]).eval()

File "/usr/local/lib/python3.5/dist-packages/theano/gof/graph.py", line 516, in eval
self._fn_cache[inputs] = theano.function(inputs, self)

File "/usr/local/lib/python3.5/dist-packages/theano/compile/function.py", line 326, in function
output_keys=output_keys)

File "/usr/local/lib/python3.5/dist-packages/theano/compile/pfunc.py", line 486, in pfunc
output_keys=output_keys)

File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 1807, in orig_function
output_keys=output_keys).create(

File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 1446, in __init__
accept_inplace)

File "/usr/local/lib/python3.5/dist-packages/theano/compile/function_module.py", line 177, in std_fgraph
update_mapping=update_mapping)

File "/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py", line 174, in __init__
self.__import_r__(output, reason="init")

File "/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py", line 345, in __import_r__
self.__import__(variable.owner, reason=reason)

File "/usr/local/lib/python3.5/dist-packages/theano/gof/fg.py", line 390, in __import__
raise MissingInputError(error_msg, variable=r)

MissingInputError: Input 0 of the graph (indices start from 0), used to compute sigmoid(a1_interval__), was not provided and not given a value. Use the Theano flag exception_verbosity='high', for more information on this error.

# Fixed code
def _update_start_vals(a, b, model):
    """Update a with b, without overwriting existing keys. Values specified for
    transformed variables on the original scale are also transformed and inserted.
    """
    if model is not None:
        for free_RV in model.free_RVs:
            tname = free_RV.name
            for name in a:
                if is_transformed_name(tname) and get_untransformed_name(tname) == name:
                    transform_func = [
                        d.transformation for d in model.deterministics if d.name == name
                    ]
                    if transform_func:
                        b[tname] = (
                            transform_func[0].forward_val(a[name], point=b).eval()
                        )

    a.update({k: v for k, v in b.items() if k not in a})