Skip to content
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

Add implicit partial for multiple indexing #231

Closed
cgarciae opened this issue Mar 4, 2017 · 3 comments
Closed

Add implicit partial for multiple indexing #231

cgarciae opened this issue Mar 4, 2017 · 3 comments

Comments

@cgarciae
Copy link

cgarciae commented Mar 4, 2017

I am trying to run this:

        return (
            inputs.s
            |> tf.layers.dense$(?, 32, activation=tf.nn.relu, name='relu_layer', **ops)
            |> tf.nn.dropout$(?, inputs.keep_prob)
            |> tf.layers.dense$(?, 1, name='linear_layer', **ops)
            |> .[:, 0]
        )

but I am getting

CoconutParseError: parsing failed (line 147)

This other form is not working either

        return (
            inputs.s
            |> tf.layers.dense$(?, 32, activation=tf.nn.relu, name='relu_layer', **ops)
            |> tf.nn.dropout$(?, inputs.keep_prob)
            |> tf.layers.dense$(?, 1, name='linear_layer', **ops)
            |> lambda t: t[:, 0]
        )

I had to wrap the lambda inside parenthesis for the compiler to work properly:

        return (
            inputs.s
            |> tf.layers.dense$(?, 32, activation=tf.nn.relu, name='relu_layer', **ops)
            |> tf.nn.dropout$(?, inputs.keep_prob)
            |> tf.layers.dense$(?, 1, name='linear_layer', **ops)
            |> (lambda t: t[:, 0])
        )
@evhub
Copy link
Owner

evhub commented Mar 4, 2017

@cgarciae The problem is that .[:, 0] is not a valid implicit partial, since as currently implemented it doesn't support comma syntax. That's definitely something worth implementing, though. Another workaround until then is (-> _[:, 0]) using implicit lambda syntax.

@evhub evhub added this to the v1.2.3 milestone Mar 4, 2017
@evhub evhub changed the title Compilation error when using pipe operator Add implicit partial for multiple indexing Mar 4, 2017
evhub added a commit that referenced this issue Mar 21, 2017
@evhub
Copy link
Owner

evhub commented Mar 22, 2017

@cgarciae Fixed on coconut-develop! Just pip install coconut-develop to get the new behaviour.

@evhub evhub closed this as completed Mar 22, 2017
@cgarciae
Copy link
Author

Thanks!

@evhub evhub mentioned this issue May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants