November 2019
Intermediate to advanced
296 pages
7h 52m
English
As you may have already guessed, TensorFlow.js doesn't have a notion of sessions like TensorFlow does. We can execute operations eagerly so that we can control when we run them. The operation graph is naturally constructed by the chain of the operation API. To run the calculation, we only need to get the tensor of the output:
const a = tf.tensor([1, 2, 3]);// Operation chain does not execute the computation by itself.const result = a.square().log().neg().floor();// Getting the result will kick the computation of result and all dependent operations.result.data().then(d => { console.log(d);});
This is another reason why asynchronous data fetching is recommended. The huge operation chain, as is often the case for the machine ...
Read now
Unlock full access