XUtils

tfd

Tensorflow wrapper for D


tfd: tensorflow for D

linux windows codecov Dub version

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:

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>

Articles

  • coming soon...