Description
Description
The first assignment will offer an introduction to programming in TensorFlow and background math.
1. TensorFlow (50%)
Re-implement the Keras tutorial for image classification in TensorFlow without using the tf.keras*
objects. Train both models for at least 50 epochs. Compare the performance (loss, accuracy, runtime)
of your implementation to the Keras tutorial provided on moodle (KerasImageClassification.ipynb).
Hint: Use tensorboard for plotting.
You can use tf.keras.datasets to load the fashion mnist dataset
2. CPU vs. GPU computation (15%)
Write the TensorFlow code to generate two random square matrices and perform a matrix multiplication. Create a table that reports the compute time for this operation performed on the CPU vs. on
the GPU, for matrices of increasing matrices of increasing sizes 500, 1000, 5000, 10000.
3. Differentiation (15%)
Given the following expression:
y = 3x
2 + 2x + 3, (1)
• Note that x2 denotes the element-wise multiplication, i.e. x x
• Provide an expression for the Jacobian of y by hand
• Implement the expression in TensorFlow, and print out the result of performing automatic
differentiation of the expression. Compare this to the result of evaluating your manually derived
expression. As a test case, use:
x =
1
3
(2)
4. Eigenvectors (15%)
Showing your work, derive eigenvalues and eigenvectors by hand for:
A =
3 2
2 3
(3)
Good Code Style (5 %)
1
Submission
Upload your the notebook for your code and a PDF that includes en explanation of what you did, the
output of your code and your math solutions (you can scan in hand-drawn pages).
Marks will be given for clean code, short functions and meaningful variable names. Be aware that
good comments and coding style will most likely increase your mark by more than the code style
marks, because the easier the code is to understand the easier it will be to mark.
We check the code for similarities. It is against university policy to copy or share individual work
submitted for assignments. You are encouraged to discuss the programming assignments with other
students, as long your programs and write-ups are done separately. As a rule of thumb, at no time
should you find yourself looking at the code or writeup of another student. If you find relevant ideas,
information, or code snippets on the web, you are free to use them in your assignment, but you must
cite the source very specifically, otherwise it will be treated the same as copying another student’s
work. Students that copy / share source code will be penalized.
2