node-tensorflow icon indicating copy to clipboard operation
node-tensorflow copied to clipboard

Enable graph building using C APIs?

Open nikhilk opened this issue 6 years ago • 1 comments

The new C APIs support building ops and adding them to the Graph. For example, from https://www.tensorflow.org/install/install_java

// Construct the computation graph with a single operation, a constant
// named "MyConst" with a value "value".
try (Tensor t = Tensor.create(value.getBytes("UTF-8"))) {
  // The Java API doesn't yet include convenience functions for adding operations.
  g.opBuilder("Const", "MyConst").setAttr("dtype", t.dataType()).setAttr("value", t).build();
}

We could provide equivalent in node.js (only better, in terms of API compared to Java). However, how useful is it ... vs. the idea of constructing graphs entirely in Python or with JSON (once #22 is fixed).

nikhilk avatar Jan 06 '18 18:01 nikhilk

ecd28d71fa944ec7ecda920ee07650d9c371288c allows for JSON object for specifying graphs. This might be more interesting that making repeated calls to TF APIs for each op.

nikhilk avatar Jan 16 '18 02:01 nikhilk