fsprojects / fsharp-ai-tools

TensorFlow API for F# + F# for AI Models eDSL
MIT License
213 stars 17 forks source link

Bug in ImageClassifier.fsx #20

Closed sir-deenicus closed 5 years ago

sir-deenicus commented 5 years ago

In the ImageClassifier.fsx example, the line below causes an error: Dimension -1 must be >= 0

let input_placeholder =
    graph.Placeholder
        (TFDataType.Float32, shape = TFShape(-1L, -1L, -1L, 3L),
         name = "new_input")

Removing the shape parameter allows the demo to run successfully. But something like this also works:

TFShape(Some ([|None; None; None; Some 3|] |> Array.map Dimension))

Should -1L be detected and mapped to None in the constructors, something like what happens in shape?

moloneymb commented 5 years ago

Thanks for finding that, it's fixed in my branch Grads1, I planned on merging into master later this week. I've just been bogged down with some native work. If you'd like you can message me on Slack or Skype to get quicker responses.

https://github.com/fsprojects/TensorFlow.FSharp/blob/eabb758b03817a1e1293b303a59926357de27067/src/TensorFlow.FSharp/Tensorflow.fs#L680

moloneymb commented 5 years ago

To be honest, TFShape(None, None, None, Some 3) doesn't look as bad as I thought it would. I might add that as a constructor option. I haven't been focusing on this sort of API ergonomics.

sir-deenicus commented 5 years ago

it's fixed in my branch Grads1

Nice, thanks!

To be honest, TFShape(None, None, None, Some 3) doesn't look as bad as I thought it would. I might add that as a constructor option. I haven't been focusing on this sort of API ergonomics.

Hmm yeah, I think that'd be nice to have. And thanks for the work put into this awesome library, by the way.

If you'd like you can message me on Slack or Skype to get quicker responses.

Thanks yea, where is this? I'm interested in putting together say, a Transformer architecture using this framework.

moloneymb commented 5 years ago

This should now be fixed.

moloneymb commented 5 years ago

Oops, I didn't see your response as I had not refreshed the issue page.

I would love to see a Transformer architecture, I haven't had time to dig into it. There is the new one Transformer XL that'll be really cool to see.

Slack is the F# Software Foundation Slack page, I believe you can join through here https://fsharp.nationbuilder.com/forms/user_sessions/new once signed up you should get a slack invite.