Day 2 of DL job search.

Abdelrahman Helaly
3 min readDec 20, 2020

--

Hello and welcome back!

C++ review!

This is part of me, re-iterating on C++ to make sure that my python time didn’t get me all rusty.

i reviewed today the “const” keyword

when you define const int a=3; you define a ‘constant’ variable, meaning that no point in this project, you will be allowed to modify or change that number

and what’s even better, pointers are not allowed to be assigned to ‘a’ unless they make one promise! they too will not change the value of a.

and this is done by saying const int *ptr, which means that i cannot modify the contents of the pointer, but i can reassign the pointer to something else later on.

the output will be 4

but if you decided to remove the ‘const’ from the defination of the pointer, an error will be raised, because this means that b can at some point modify the variable, and it has to remain constant.

another use of const with pointers is saying: int * const a;

output will be 4

This means that the pointer is will always be pointing to X, it cannot be reassigned to another variable.

Last use of const is funcutions!

we can define a class like this

when we define it like that, you are making a promise, that this GetMyVar() function will not change the contents of the class.

the beautiful thing about C++ shows up (i learned that from Cherno on Youtube)!

is when you have a const object for example

this will work perfectly fine, because the GetMyVar functions has const, which means it’s safe to pass the const object to it, as it made a promise that it will not modify that object.

but if i remove the const word from the function definition, it will raise an error.

but what if, what if i want for some reason to modify something inside a function that is defined as const.

the mutable keyword comes to the rescue, it allows that kind of functions to modify the variable that are marked as mutable, how cool.

i also took some time to answer all of these 25 Questions found Here.

and this article as

Complete C++ Interview Questions & Answers | by Mohit Soni | Analytics Vidhya | Medium

Read Big O Notation Chapter in Grokking Algorithms book.

QT and Paint …. and Deep Learning!

Tomorrow’s interview will be mainly about Qt and Deep learning.

so as a refresher, i decided to implement a semi-paint program, that the user will be able to draw using the mouse and then when he releases a prediction will be made, telling him what number did he draw.

and the decision is made using MNIST pytorch network.

Example of the paint program output

it’s a very simple paint program.

and now, we go to implement a simple pytorch network, we will use Transfer learning to get an early start, and we will use the all time favourite..VGG16.

i decided to use threads to communicate with pytorch and draw at the same time.

The training loss is decreasing but it’s a very slow training process, will try and use the gpu on colab tomorrow.

Threads in Qt

QFuture is a high-level class that deals with asynchronous computation.

We use the QFutureWatcher class to let QFuture interact with signals and slots. You can even use this for displaying the progress of the operation on a progress bar.

--

--

No responses yet