That would be worth trying, but not sure to work. The challenge is sneaking
a var through the argument checking. The var must equal a valid dtypes to
satisfy the theano constructor, but not equal the input dtype for
unification to work. I would suggest that a context manager switch between
two definitions of eq in eg lpint.
On Mar 29, 2013 8:17 AM, "Matthew Rocklin" <notifications@github.com> wrote:

> In theano_workspace/logpy_opt.py:
>
> > -                    eq(w['set_instead_of_inc'], True),
> > -                    eq(w['rval'], (tensor.add, w['in_inc']))],
> > -                [
> > -                    eq(w['set_instead_of_inc'], False),
> > -                    eq(w['rval'], (tensor.add, w['in_x'], w['in_inc']))]
> > -                ),
> > +    # TODO: how to design re-usable patterns? (dtype, ndim, etc.)
> > +    shape_dimo = goalifyN(
> > +        shape_dim(node.fgraph.shape_feature.shape_of))
> > +    jj = lpint(238908925034, 'j') # -- a number that cannot occur in the graph
> > +    x = lptensor('x', 'float32', [False])
> > +    y = lptensor('y', 'float32', [False])
> > +    x0 = var('x0')
> > +    rval = [y]
> > +    goals = (
> > +            (eq, node.outputs[0], tensor.set_subtensor(x[0:jj], y)),
>
> If so, that's awesome. What if you wanted to make this work on all
> datatypes by making 'float32' a logic var. Would you need to make lpstras well?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/jaberg/theano_workspace/pull/1/files#r3585092>
> .
>