Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A ground-up and standalone reimplementation of TensorFlow for ruby. Comes with a pure ruby and OpenCL opcode evaluator
| Date | Stars |
|---|---|
| 2026-07-24 | 506 |
| 2026-07-25 | 506 |
| 2026-07-28 | 506 |
| 2026-07-30 | 506 |
| 2026-08-06 | 506 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
[](https://badge.fury.io/rb/tensor_stream)[](https://badge.fury.io/rb/tensor_stream-opencl)[](https://circleci.com/gh/jedld/tensor_stream) [](https://gitter.im/tensor_stream/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# TensorStream
TensorStream is an opensource framework for machine learning for ruby, its goal is to allow machine learning models to be easily built and run them in various hardware like GPUs and CPUs. It is heavily based on TensorFlow with the goal of being able to easily port its higher level libraries and model examples. As such it is also based on data flow graphs wherein you define computations and data flows between those computations in order to achieve the desired output.
TensorStream is designed to support various backends with a Pure Ruby and OpenCL implementation. These implementations are designed to work together, you can perform training on an OpenCL implementation (where you have a GPU) and then run the resulting trained model on a Pure Ruby implementation where you can deploy anywhere that you can run ruby on. TensorStream has been tested to run on most ruby implementations like MRI, JRuby and TruffleRuby.
## Goals & Features
- Easy to use - Improve model readability
- Replicates most of the commonly used low-level tensorflow ops (tf.add, tf.constant, tf.placeholder, tf.matmul, tf.sin etc...)
- Supports auto-differentiation using formal derivation
- Extensible - use your own opcode evaluator (OpenCL and Pure ruby currently supported)
- wide support - Run on most ruby implementations as well as hardware acceleration on OpenCL supported hardware
## Compatibility
TensorStream comes with a pure ruby and OpenCL implementation out of the box. The pure ruby implementation
is known to work with most ruby implementations including TruffleRuby, JRuby as well as jit enabled versions of mri (ruby-2.6.0).
OpenCL is supported only on mri implementations of ruby. This can be enabled by adding OpenCL evaluator gem (Make sure you have OpenCL drivers installed correctly on your system):
```Gemfile
gem 'tensor_stream-opencl'
```
and then (without bundler)
```ruby
require 'tensor_stream/opencl'
```
OpenCL is basically a requirement for deep learning and image processing tasks as the ruby implementation is too slow even with jit speedups using latest ruby implementations.
OpenCL kernels used by tensorstream can be found at tensor_stream/lib/evaluator/opencl/kernels. These are non specific and should work with any device that supports OpenCL including intel GPUs and CPUs, as well as GPUs from Nvidia and AMD.
## Installation
Installation is easy, no need to mess with docker, python, clang or other shennanigans, works with both mri and jruby out of the box.
Add this line to your application's Gemfile:
```ruby
gem 'tensor_stream'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install tensor_stream
## Usage
Usage is similar to how you would use TensorFlow except with ruby syntax.
There are also enhancements to the syntax to make it as consice as possible.
Linear regression sample:
```ruby
require 'tensor_stream'
tf = TensorStream
learning_rate = 0.01
training_epochs = 1000
display_step = 50
train_x = [3.3, 4.4, 5.5, 6.71, 6.93, 4.168, 9.779, 6.182, 7.59, 2.167,
7.042, 10.791, 5.313, 7.997, 5.654, 9.27, 3.1]
train_y = [1.7, 2.76, 2.09, 3.19, 1.694, 1.573, 3.366, 2.596, 2.53, 1.221,
2.827, 3.465, 1.65, 2.904, 2.42, 2.94, 1.3]
n_samples = train_x.size
x_value = Float.placeholder
y_value = Float.placeholder
# Set model weights
weight = rand.t.var name: "weight"
bias = rand.t.var name: "bias"
# Construct a linear modExcerpt of 14,436 characters
Read on GitHub151
The Gitter Badger · Gitter
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:ba4fd3054966e80b, topic:tensorflow