Error constructing Array1D

40 views Asked by At

I am trying to start learning machine learning using deeplearn.js in node-red.

To start with this I created the simple Inject>Function>Debug node flow, imported the library and copied the Getting Started example with edits to work within node-red. This looks like this:

dl = global.get('dl');
const math = dl.ENV.math;

const a = dl.Array1D.new([1,2,3]);
//const a = dl.Scalar.new(2);
const b = dl.Scalar.new(2);

const result = math.add(a, b);
return {payload: result.dataSync()};

the problem ist that dl.Array1D.new([1,2,3]); throws

Error: Error constructing Array1D. Shape of values is not 1 dimensional.

If "a" is a Scalar or Array2D everything works fine. Does someone has an idea where this Array is not 1 dimensional or how to force it to be?

0

There are 0 answers