02.- TensorFlow js en Español [Conceptos basicos]

by eucm2

HTML

<!DOCTYPE html>
<html>
    <head>
        <link rel="shortcut icon" href="favicon.ico">
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"> </script>
    </head>
    <body>
        <script>
            console.log (  tf.tensor([1, 2, 3, 4])  );
            console.log (  tf.tensor([[1.5, 2], [3, 4]],null,"int32")  );
            console.log (  tf.tensor([1, 2, 3, 4 ], [2, 2]) );
            
            console.log (  tf.scalar(3.14)  );
            console.log (  tf.tensor(3.14)  );
            
            console.log (  tf.tensor1d([1,2,3]));
            
            const val=[];
            for (i=0;i<30;i++){
                val[i]=Math.random(0,100);
            }
            tf.tensor3d(val,[5,3,2]).print();
        </script>
    </body>
</html>