B241: Robot Learning (UROB)

Undergraduate course, CTU FEE, Department of Cybernetics, 2024

Course description

The course covers deep learning methods for well-known robotic problems, such as semantic segmentation and reactive robot motion control. It aims at lasting, general knowledge rather than a catalog of deep learning architectures. Students should already know mathematics (gradient, Jacobian, Hessian, gradient descent, Taylor polynomial) and machine learning (Bayesian risk minimization, linear classifier).

The labs have two parts. In the first, students solve basic deep learning problems from scratch, including reimplementing autograd backpropagation. In the second, they build on existing templates to solve complex problems, including reinforcement learning (RL), transformers, and generative networks.

All course information is on the UROB Courseware page.

The course code lives in the urob-ctu GitHub organization.

The unofficial course materials are still under development; you can earn extra points by helping us improve them.

Lab 4: Backpropagation

This lab focuses on the backpropagation algorithm: how it works and where it comes from.

In part of the lab, you implement the algorithm from scratch to understand how it works.

Download the lab materials (lab04.zip) and the slides (lab04.pdf).

Lab 5: Convolutional neural networks

This lab focuses on convolutional neural networks: how they work and where they are used.

Download the lab materials (lab05.zip).

HW 2: Autograd

See the HW 2 Courseware page.

The homework code is in the hw2-autograd repository.

In this assignment, you implement your own autograd library, similar to the one shown in the lab. The lab covered autograd for scalar values; your solution must also work with vectors and tensors.

Task (10 pts)

Complete the engine.py file. Fill in the functions marked with ellipses (…) so they compute the forward and backward passes correctly. Also write your code between the marked start and end comments; these sections hold longer blocks of code inside higher-level autograd functions.

Use the numpy library (see the NumPy documentation). Don’t use any library with built-in autograd, such as PyTorch or TensorFlow.

Most functions need only a few lines. If you’re unsure how to approach the more complex ones, consult the lab materials before contacting the tutors.

Note that the variable other in the __pow__ function is an int or float, so you can’t add it to the parent set of the output. Backpropagation works only for Tensor objects.

You need the reshape_gradient function only in __add__ and __mul__, the two functions that involve broadcasting; it calculates the gradient for broadcasted values.

Getting started

  1. Get the files: Download them as a zip or clone the repository:
git clone https://github.com/urob-ctu/hw2-autograd.git
  1. Install requirements: Install the required Python packages:
pip install -r requirements.txt

Testing

Test your implementation with the provided test.py file. Grading uses similar but slightly different tests, and the provided file isn’t exhaustive, so test thoroughly. Run the tests:

python3 test.py

Submission and evaluation

Zip the entire directory with all assignment files and upload it to BRUTE, the faculty’s automatic evaluation system. The provided bash script zips the directory for you:

./submit.sh

You can earn up to 10 points. BRUTE grades the assignment automatically, and the tutors may re-evaluate any submission later.

You lose one point for every 24 hours past the deadline, up to 9 points.

Good luck! Don’t forget to experiment with the task, and if you have any questions or concerns, please contact me.