Edited, memorised or added to reading queue

on 15-Apr-2024 (Mon)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 7624090324236

Tags
#tensorflow #tensorflow-certificate
Question

import tensorflow as tf

#stop training after reaching accuract of 0.99
class MyCallback(tf.keras.callbacks.Callback):
  def on_epoch_end(self, epoch, logs={}):
    if logs.get('accuracy')>=0.99:
      print('\nAccuracy 0.99 achieved')
      self.[...].stop_training = True

Answer
model

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow - callbacks
g after reaching accuract of 0.99 class MyCallback(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs={}): if logs.get('accuracy')>=0.99: print('\nAccuracy 0.99 achieved') self.<span>model.stop_training = True <span>







Flashcard 7624234241292

Tags
#tensorflow #tensorflow-certificate
Question
# Create matrix
another_matrix = tf.constant([[10. ,66.],
                              [5. , 9.],
                              [13. , 4.]], dtype=tf.float16)
another_matrix


<tf.[...]: shape=(3, 2), dtype=float16, numpy=
array([[10., 66.],
       [ 5.,  9.],
       [13.,  4.]], dtype=float16)>


another_matrix.ndim
2

Answer
Tensor

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensors fundamentals - creating tensors
# Create matrix another_matrix = tf.constant([[10. ,66.], [5. , 9.], [13. , 4.]], dtype=tf.float16) another_matrix <tf.Tensor: shape=(3, 2), dtype=float16, numpy= array([[10., 66.], [ 5., 9.], [13., 4.]], dtype=float16)> another_matrix.ndim 2







Flashcard 7624252067084

Tags
#tensorflow #tensorflow-certificate
Question
changeable_tensor = tf.Variable([10, 7])

changeable_tensor[0] = 77

Output:
TypeError: 'ResourceVariable' object does not support item assignment


changeable_tensor[0].assign(77)

Output:
<tf.Variable 'UnreadVariable' shape=(2,) dtype=int32, numpy=array([[...]], dtype=int32)>

Answer
77, 7

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow basics
= 77 Output: TypeError: 'ResourceVariable' object does not support item assignment changeable_tensor[0].assign(77) Output: <tf.Variable 'UnreadVariable' shape=(2,) dtype=int32, numpy=array([<span>77, 7], dtype=int32)> <span>







Tensorflow random
#tensorflow #tensorflow-certificate
# global seed
tf.random.set_seed(42)

#operation seed
tf.random.shuffle(not_shuffled, seed=42)

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7624318913804

Tags
#tensorflow #tensorflow-certificate
Question
# global seed
tf.random.[...](42)

#operation seed
tf.random.shuffle(not_shuffled, seed=42)

Answer
set_seed

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow random
# global seed tf.random.set_seed(42) #operation seed tf.random.shuffle(not_shuffled, seed=42)







Flashcard 7624320486668

Tags
#tensorflow #tensorflow-certificate
Question
# global seed
tf.random.set_seed(42)

#operation seed
tf.random.shuffle(not_shuffled, [...]=42)

Answer
seed

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensorflow random
# global seed tf.random.set_seed(42) #operation seed tf.random.shuffle(not_shuffled, seed=42)







Properties of tensor
#tensorflow #tensorflow-certificate
print('Datatype of every element:', A.dtype)
print('Number of dimensions (rank):', A.ndim)
print('Shape of tensor:', A.shape)
print('Elements along the 0 axis:', A.shape[0])
print('Elements along the last axis:',  A.shape[-1])
print('Total number of elements:', tf.size(A))
print('Total number of elements:', tf.size(A).numpy())


Output:
Datatype of every element: <dtype: 'int64'>
Number of dimensions (rank): 4
Shape of tensor: (2, 3, 4, 5)
Elements along the 0 axis: 2
Elements along the last axis: 5
Total number of elements: tf.Tensor(120, shape=(), dtype=int32)
Total number of elements: 120

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7624355351820

Tags
#tensorflow #tensorflow-certificate
Question
print('Datatype of every element of tensor A:', [...])


Output:
Datatype of every element: <dtype: 'int64'>

Answer
A.dtype

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Properties of tensor
print('Datatype of every element:', A.dtype) print('Number of dimensions (rank):', A.ndim) print('Shape of tensor:', A.shape) print('Elements along the 0 axis:', A.shape[0]) print('Elements along the last axis:', A.shape[-1]) pri







Tensors indexing
#tensorflow #tensorflow-certificate
# Tensors can be indexed just like Python lists.

# Get the first 2 elements of each dimension
A[:2, :2, :2, :2]

statusnot read reprioritisations
last reprioritisation on suggested re-reading day
started reading on finished reading on




Flashcard 7624359808268

Tags
#tensorflow #tensorflow-certificate
Question
# Tensors can be indexed just like Python [...].

# Get the first 2 elements of each dimension
A[:2, :2, :2, :2]

Answer
lists

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensors indexing
# Tensors can be indexed just like Python lists. # Get the first 2 elements of each dimension A[:2, :2, :2, :2]







Flashcard 7624361381132

Tags
#tensorflow #tensorflow-certificate
Question
# Tensors can be indexed just like Python lists.

# Get the first 2 elements of each dimension
A[[...]]

Answer
:2, :2, :2, :2

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Tensors indexing
# Tensors can be indexed just like Python lists. # Get the first 2 elements of each dimension A[:2, :2, :2, :2]