anshuman23 / tensorflex

Tensorflow bindings for the Elixir programming language :muscle:
https://hexdocs.pm/tensorflex/Tensorflex.html
Apache License 2.0
308 stars 14 forks source link

Tensors of TF_FLOAT and TF_DOUBLE type both supported #10

Closed anshuman23 closed 6 years ago

anshuman23 commented 6 years ago

For the time being, both the TF_FLOAT and TF_DOUBLE tensor types are now supported. The matrices created are still 64 bit floats, though. I do not want to complicate the matrix functions right now, as at the end we will move to using Matrex more than the in-house Tensorflex matrix functions.

Next up: Support for Tensorflow Sessions!

josevalim commented 6 years ago

@versilov how do we control the type in matrex? are they always 64-bit precision floats?

versilov commented 6 years ago

@josevalim, right now all matrices in Matrex are 2-d arrays of 32-bit floats. It takes twice less space and is twice faster in operation, than double.

I am now working in array branch on new representation inspired by NumPy's mdarray: with support for different types, arbitrary dimensions, storing data shape separately from the data and with strides (which gives us constant time transposing, for example).

At the moment I am going to support these types: :float32 | :float64 | :int16 | :int32 | :int64 | :byte | :bool

I'll try to preserve existing API as much, as possible, with 32-bit float being the default data type.

See https://github.com/versilov/matrex/blob/array/lib/matrex/array.ex

josevalim commented 6 years ago

At the moment I am going to support these types: :float32 | :float64 | :int16 | :int32 | :int64 | :byte | :bool

Beautiful. If there is anyway I can help please let me know! I will take a look at the code later today.

versilov commented 6 years ago

It's a bit early for code review, right now I'am stuck with this question: https://elixirforum.com/t/define-a-set-of-functions-with-a-macro/14517

I started reading "Metaprogramming Elixir", but would be grateful, if you point me in the right direction:)

josevalim commented 6 years ago

@versilov sorry for the delay, i posted an answer there. :)