I tried building from the source tfjs-layers so I could see changes I have made to the code, however following this series of steps:
tfjs directory delete node-modules.
then in the tfjs-layers directory type `yarn link` then `yarn build`
then in the tfjs directory type `yarn link "@tensorflow/tfjs-layers"` then `yarn`
then in the tfjs directory running `yarn build-npm` and taking 'dist/tf.js' and using it in my browser
I get this error:
```
tf.js:25195 Uncaught Error: cpu backend was already registered as global
at Environment.registerBackend (tf.js:25195)
at Object.45.../environment (tf.js:13684)
at s (tf.js:1)
at tf.js:1
at Object.126../environment (tf.js:22787)
at s (tf.js:1)
at tf.js:1
at Object.44../browser_util (tf.js:12259)
at s (tf.js:1)
at tf.js:1
```
which seems to originate from these lines around line 22784 (tf.js)
```
var backend_cpu_1 = require("./kernels/backend_cpu");
var backend_webgl_1 = require("./kernels/backend_webgl");
```
if i delete these 2 lines i get this error
```
Uncaught Error: Tensor is disposed.
at Tensor.throwIfDisposed (tf.js:22068)
at Tensor.slice (tf.js:22131)
at Object.qr (tf.js:569)
at Orthogonal.apply (tf.js:6037)
at LSTMCell.Layer.addWeight (tf.js:2611)
at LSTMCell.build (tf.js:9172)
at StackedRNNCells.build (tf.js:9540)
at RNN.build (tf.js:8341)
at tf.js:2525
at Object.nameScope (tf.js:1785)
```
this error originates around 6034 (tf.js)
```
K.randomNormal(normalizedShape, 0, 1, types_1.DType.float32);
``
after calling tf.layers.rnn().apply() in this code roughly
```
const inputs = tf.input({
shape:[options.seqLength]
});
let cells = [];
for(let i = 0; i < options.numLayers; i++) {
const cell = tf.layers.lstmCell({
units: options.hiddenSize
});
cells.push(cell);
}
tf.layers.rnn({
cell: cells,
returnSequences: true
}).apply(inputs);
```
because isDisposed property is automatically set to true for some reason
I'm not sure if this is a bug or I have just set the project up incorrectly
Thanks for any help