Skip to content

anshuman23/tensorflex

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TensorflEx

Pre-application Milestones

  • Simple TF_Version Hello World test

    • The first commit refers to the rather simplistic hello world program for the C API and not in general for Tensorflow. This is present here. This Hello world test works!
  • Graph, Tensor & Session based proper TF Hello World test

    • The better hello world test is to be able to program a real "Hello World!" TF program. This would involve declaring a string as a Tensorflow constant and then run a session to print the Tensor in a graph. As Python is still the best client for TF, this would look something like this in Python:
    import tensorflow as tf
    
    with tf.Session() as sess:
        print(sess.run(tf.constant("Hello World!")))
    OUTPUT: "Hello World!"
    

    This requires the creation of C bindings capable of creating a new graph, constant string tensors, new operations, creating a session and then running it. All the code has been done so far for running string tensors in sessions (after graphs and operations have been created) in the NIF. This works as well.

How to run these

  • Before doing anything, on the command line type make (You will see some warnings-- ignore them, they have been taken care of) to compile the C NIF code in src.

  • Simple TF_Version Hello World test:

    • Next, open up iex:
      iex(1)> c "TensorflEx.ex"
      [TensorflEx]
      
      iex(2)> IO.puts "Hello World! Tensorflow #{TensorflEx.tf_version}"
      Hello World! Tensorflow 1.4.1
      :ok
  • Graph, Tensor and Session based proper TF Hello World test:

    • Open up iex:
      iex(1)> c "TensorflEx.ex"
      [TensorflEx]
      
      iex(2)> graph = TensorflEx.tf_new_graph
      2018-02-03 21:06:07.923328: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
      #Reference<0.85340593.4211212290.58261>
      
      iex(3)> op_desc = TensorflEx.tf_new_op(graph, "Const", "test")
      #Reference<0.85340593.4211212290.58539>
      
      iex(4)> tensor = TensorflEx.tf_string_constant('Hello World!')
      'Hello World!'
      
      iex(5)> IO.puts TensorflEx.tf_create_and_run_sess(graph, op_desc, tensor)
      => [INFO] Loaded Graph correctly
      => [INFO] Loaded Operation Description correctly
      => [INFO] Session Run Complete
      Hello World!
      :ok
      

Summer and post-application milestones

  • Will be added in time

About

Tensorflow bindings for the Elixir programming language 💪

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published