Skip to content

Instantly share code, notes, and snippets.

@generic-github-user
Last active February 3, 2019 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save generic-github-user/7c79b9ce7f14cad21949bd5b97611e15 to your computer and use it in GitHub Desktop.
Save generic-github-user/7c79b9ce7f14cad21949bd5b97611e15 to your computer and use it in GitHub Desktop.
Checking how many elements match in two tensors
const a = tf.tensor1d([1,2,3,4,5,6,7]);
const b = tf.tensor1d([1,2,3,4,8,9,0]);
const matching = tf.equal(a, b).mean().mul(a.size);
matching.print();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment