human
Complete the below
def infer_shape(outs, inputs, input_shapes):

    ''''Compute the shape of the outputs given the shape of the inputs of a theano
    graph.
    We do it this way to avoid compiling the inner function just to get
    the shape. Changes to ShapeFeature could require changes in this function.'
    '''
 ... Write me a Python program to compute the shape of the outputs given the shape of the inputs of a theano?
assistant
#Here is Python program to compute the shape of the outputs given the shape of the inputs of a theano
.
    for (inp, inp_shp) in izip(inputs, input_shapes):
        if ((inp_shp is not None) and (len(inp_shp) != inp.ndim)):
            assert (len(inp_shp) == inp.ndim)
    shape_feature = tensor.opt.ShapeFeature()
    shape_feature.on_attach(theano.gof.FunctionGraph([], []))
    for (inp, inp_shp) in izip(inputs, input_shapes):
        shape_feature.set_shape(inp, inp_shp)
    def local_traverse(out):
        '\n                                Go    back    in    the    graph,    from    out,    adding    computable    shapes    to    shape_of.\n\n                                '
        if (out in shape_feature.shape_of):
            return
        elif (out.owner is None):
            shape_feature.init_r(out)
        else:
            for inp in out.owner.inputs:
                if (not (inp in shape_feature.shape_of)):
                    local_traverse(inp)
            dummy_fgraph = None
            shape_feature.on_import(dummy_fgraph, out.owner, reason='dummy')
    ret = []
    for o in outs:
        local_traverse(o)
        ret.append(shape_feature.shape_of[o])
    return ret