How to use the @tensorflow/tfjs-node-gpu.tensor function in @tensorflow/tfjs-node-gpu

To help you get started, we’ve selected a few @tensorflow/tfjs-node-gpu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bobiblazeski / js-gym / dist / agents.gpu.js View on Github external
Object.keys(experiences).map(function(key) {
        tensorified[key] = tf.tensor(experiences[key]);        
      });      
      const {states, actions, rewards, nextStates, dones} = tensorified;
github bobiblazeski / js-gym / dist / agents.gpu.js View on Github external
const action = tf.tidy(() => {
      let action = tf.squeeze(this.actor.predict(tf.tensor([state])));
      if (train) {
        const noise = softmax(this.noise.sample());        
        action = action.mul(1-this.epsilon).add(tf.mul(noise, this.epsilon));
      }
      return action;
    });
    const data = await action.data();