Skip to content

nelyj/tensorflow.rb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ruby-Tensorflow

Description

This repository contains Ruby API for utilizing TensorFlow.

Code Climate Join the chat at https://gitter.im/Arafatk/tensorflow.rb

Documentation

Everything is at RubyDoc. You can also generate docs by bundle exec rake doc.

Docker

Launch:

docker run -it nethsix/ruby-tensorflow-ubuntu:0.0.1 /bin/bash -c "source /usr/local/rvm/scripts/rvm; /bin/bash"

Try:

ruby /repos/ruby-tensorflow/examples/tf_ex1.rb

Location: /repos/ruby-tensorflow/

For details, see: https://hub.docker.com/r/nethsix/ruby-tensorflow-ubuntu/

Dependencies

Explicit Install

Implicit Install (No Action Required)

Installation

All the dependencies mentioned above must be installed in your system before you proceed further.

Clone and Install TensorFlow

This package depends on the TensorFlow shared libraries, in order to compile these libraries do the following:

git clone --recurse-submodules https://github.com/tensorflow/tensorflow
cd tensorflow

This command clones the repository and a few sub modules. After this you should do:

bazel build //tensorflow:libtensorflow.so

This command takes in the order of 10-15 minutes to run and creates a shared library. When finished, copy the newly generated libtensorflow.so shared library:

# Linux
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/lib/

# OSX
sudo cp bazel-bin/tensorflow/libtensorflow.so /usr/local/lib

Install ruby-tensorflow

Clone and install this Ruby API:

git clone https://github.com/Arafatk/ruby-tensorflow.git
cd ruby-tensorflow
cd ext/sciruby/tensorflow_c
ruby extconf.rb
make
make install # Creates ../lib/ruby/site_ruby/X.X.X/<arch>/tf/Tensorflow.bundle (.so Linux)
cd ./..
bundle exec rake install

The last command is for installing the gem.

Run tests and verify install

bundle exec rake spec

This command is to run the tests.

License

Copyright (c) 2016, Arafat Dad Khan. somatic

All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 77.3%
  • C 14.3%
  • C++ 7.4%
  • Other 1.0%