Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 2.61 KB

README.md

File metadata and controls

70 lines (51 loc) · 2.61 KB

tfd: tensorflow for D

linux windows codecov Dub version

Installation

  • If your project needs only TF C API bindings: $ dub add tfd:deimos
  • If your project needs entire tfd packages: $ dub add tfd

see also Requirements

Example

Mir is to tfd what NumPy is to Tensorflow.

/// tensor add

import tfd;
import mir.ndslice : as, iota;

with (newGraph)
{
  auto i = iota(2, 3, 4).as!float;

  Operation x = placeholder!float("x", 2, 3, 4);
  Operation two = constant(i);
  Operation add = x + two;

  Tensor addVal = session.run([add], [x: i.tensor])[0];
  assert(addVal.sliced!(float, 3) == i * 2);
}

And more:

Features

  • dpp generated C API bindings
  • Support @nogc nothrow.
  • Setup CI
  • Wrap tensor and session for basic usages (see tfd.session unittests).
  • mir.ndslice.Slice s <=> tfd.tensor.Tensor t integration by s.tensor, t.slicedAs(s).
  • Example to save/load TF graphs.
  • Use pbd to save/load proto files.
  • Parse ops.pbtxt to generate typed ops bindings.
  • Rewrite C API example with typed bindings.
  • Implement autograd, and simple training APIs in D.
  • Support cloud TPU.
  • Support dip1000.

Requirements

Re-generate bindings

tfd uses dpp to generate bindings from TF C-API. You need libclang to run dpp.

dub fetch dpp
dub run dpp -- --preprocess-only --include-path ./download/include <target dpp file>