0.1.0 released

Deep Learning for Crystal

GitHub Release Build Status Documentation

MXNet is a library for deep learning, written in C++. It provides bindings for many popular languages (Python, Scala, R, etc.). provides bindings for Crystal. follows the design of the Python bindings, albeit with Crystal syntax. The following code:

require "mxnet"
a = MXNet::NDArray.array([[1, 2], [3, 4]])
b = MXNet::NDArray.array([1, 0])
puts a * b


[[1, 0], [3, 0]]
<NDArray 2x2 int32 cpu(0)>

Installation requires MXNet.

Build MXNet from source (including Python language bindings) or install the library from prebuilt packages using the Python package manager pip, per the MXNet installation instructions:

And add the following to your application's shard.yml:

    github: toddsundsted/

Troubleshooting relies on the Python library to find the installed MXNet shared library (""). You can verify MXNet is installed with the following Python code:

import mxnet as mx
a = mx.ndarray.array([[1, 2], [3, 4]])
b = mx.ndarray.array([1, 0])
print(a * b)

which outputs:

[[1. 0.]
 [3. 0.]]
<NDArray 2x2 @cpu(0)>

On OSX, you may need to give the compiled Crystal executable a hint about the location of the shared library. If you see an error message like the following:

dyld: Library not loaded: lib/
  Referenced from: /Users/homedirectory/.cache/crystal/crystal-run-eval.tmp
  Reason: image not found

you need to either: 1) manually set the DYLD_FALLBACK_LIBRARY_PATH environment variable to point to the directory containing the shared library, or 2) move or copy the library into a well-known location.

The Crystal build step does not currently set the path to the library explicitly and OSX does not currently look for shared libraries in non-standard locations without guidance.

Status currently focuses on supporting most of the basic arithmetic operations on arrays and symbols, with support for symbolic evaluation and some support for automatic differentiation thrown in. Almost all operations in the library are exposed, however, via the automatically generated Ops, Sparse, Linalg, etc. modules but documentation and guidance are nonexistent at this time.

  github: toddsundsted/
  version: ~> 0.1.0
Crystal 0.27.2


  • Todd Sundsted

Libraries 1

  • libmxnet: >= 1.2.1

Dependencies 0

Development Dependencies 0

Dependents 0

Last synced .
search fire star recently