Title: 544
Tags: lec5

Q: Why are the three main numeric types in Python?
A: integers, floating point numbers, and complex numbers

Q: Of integers and floats, what support is there for Infinity?
A: Floats support this, ints do not

Q: If you have a type like intN or floatN, how many bytes does it take?
A: N/8
For example, int32 takes 4 bytes

Q: What is the unsigned equivalent of int16?
A: uint16

Q: When we choose between different numeric types, what are three things we're trading off?
A: precision (specifying small differences)
range (difference between smallest and biggest possible numbers)
space (how many bytes does it take?)

Q: If you invent a new bit layout to represent your numbers, what will you need to worry about with respect to performance?
A: Existing CPUs won't have built-in operations for your type.  So you'll need to implement operations like multipy in software (which is slower than hardware), or convert to another type the CPU can directly work with on an as-needed basis (also slow)

Q: What happens when you add negative infinity and positive infinity?
A: You get NaN (not a number)

Q: What does sys.float_info.dig tell you?
A: The maximum number of decimal digits that can be faithfully represented in a float

Q: What does sys.float_info.epsilon tell you?
A: difference between 1.0 and the next number after 1.0 that we can represent with a Python float

Q: If you want torch.rand(...) to give you the same pseudorandom numbers each time, what must you do?
A: "seed" the randomizer
torch.manual_seed(SOME_NUMBER)

Q: If you want to move a CPU tensor A to a GPU tensor B, what do you do?
A: B = A.to("cuda")

Q: torch.sigmoid(x) will return numbers between _____ and _____
A: 0, 1

Q: How do we matrix multiply A and B in PyTorch?
A: A @ B

Q: If you want to create a callable type, what special method do you need in your class?
A: __call__

Q: x = torch.rand(a, b)
y = torch.rand(c, d)
When will x @ y work?
A: When b = c

Q: x = torch.rand(a, b)
y = torch.rand(c, d)
If x @ y works, what will be the resulting shape?
A: (a, d)

Q: How many columns will it have?
A = torch.rand(x, y)
A: y

Q: model = torch.nn.Linear(x, y)
preditions = model(data)
How many columns must data have?
A: x