Fast.ai Lesson 13 notes — Part 2 v3

This shows where Swift4TF is located
The error message tells you where errors are located.
A function that takes two floats as parameters and returns a float.
This also shows how to return two variable tuples.
This reminds the Swift struct
This makes it plausible to say that we want to create a struct with two numbers that are the same type but we don’t know the type yet.
In Swift, it is normal to add functions later.
Instead of just writing add we can use the operator.
The coolest thing so far, in my opinion, is that you can define own operators.

What is a compiler?

This is how compilers work. We need to create own frontend for every language and own backend for every type of hardware.
Then there is LLVM that can be used so a lot of code between frontend and backend can be shared. I believe that this is the thing that made Chris Latter famous although he have made a lot of other important things like Swift.
To optimize compilers we should take, for example, the multiplication out of for loop. LLVM do this kind of things for us.
This is a part of float implementation in Swift.
There is a lot of ways to create tensors.
This is how matrix multiplication is implemented in Swift.
This calculates how long function took to run. From 00_load_data.ipynb

Working with Tensor

Matrix multiplication
Pointwise operations can be done by adding a dot.
Matmul with tensors is a lot slower than even Python version.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store