Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Data Types | Tensors
Introduction to TensorFlow

bookData Types

123456789101112
import tensorflow as tf # Creating a tensor of type `float16` tensor_float = tf.constant([1.2, 2.3, 3.4], dtype=tf.float16) # Creating a tensor of type `int64` tensor_int = tf.constant([1, 2, 3], dtype=tf.int64) # Display tensors print(tensor_float) print('-' * 50) print(tensor_int)
copy
123456789101112
import tensorflow as tf # Create a tensor tensor_float = tf.constant([-1.2, 2.3, 3.8]) # Convert our `tensor_float` from `float32` to `int32` tensor_int_converted = tf.cast(tensor_float, dtype=tf.int32) # Display a tensor print(tensor_float) print('-' * 50) print(tensor_int_converted)
copy
Opgave

Swipe to start coding

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 7
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Opsummér dette kapitel

Explain code

Explain why doesn't solve task

close

Awesome!

Completion rate improved to 5.56

bookData Types

Stryg for at vise menuen

123456789101112
import tensorflow as tf # Creating a tensor of type `float16` tensor_float = tf.constant([1.2, 2.3, 3.4], dtype=tf.float16) # Creating a tensor of type `int64` tensor_int = tf.constant([1, 2, 3], dtype=tf.int64) # Display tensors print(tensor_float) print('-' * 50) print(tensor_int)
copy
123456789101112
import tensorflow as tf # Create a tensor tensor_float = tf.constant([-1.2, 2.3, 3.8]) # Convert our `tensor_float` from `float32` to `int32` tensor_int_converted = tf.cast(tensor_float, dtype=tf.int32) # Display a tensor print(tensor_float) print('-' * 50) print(tensor_int_converted)
copy
Opgave

Swipe to start coding

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

close

Awesome!

Completion rate improved to 5.56
Sektion 1. Kapitel 7
single

single

some-alt