Closed lilyminium closed 3 years ago
Thanks for taking the time to write this out!
Yes, order can distinguish between them but most libraries use rank and so we'll use that instead. I've revised this to be clearer
Was not aware of intershinx! Looks useful, will add an issue about it
The angry face was more about the lack of consistency. I put it next to pytorch's unsqueeze, since that's the real odd one out!
Tried to revise to be clearer
revised
I added one, will add more soon!
Your understanding is correct. Revised to be clearer. A short answer (using the lessons on broadcasting!) is x[...,np.newaxis] - [3.5, 2.5]
. I've added some input/output examples to be more clear. Probably easier to understand with examples.
Thank you again for the detailed feedback and I hope you're learning something new!
Closed by 0d89a4d059f2ef76d17385e18a324e112fc5e039
I split this up from #26 for clarity. Most feedback is quibbling about language choice, so I broke that up into sections by heading as well.
1. Tensors and shapes
I suppose using tensor order to distinguish from matrix rank is non-conventional? It's just a little confusing when linear algebra is fairly pertinent to a lot of machine learning.
A Euclidean vector?
1.2.1 reduction operations
I understand that numpy is implied, but
sum
is also a built in function, and does not take axis as a keyword argument. Perhapsnp.sum
would be clearer?I've not used Jupyter Book before -- if intersphinx works on it, it could be a really great way to auto-link to other library's documentation.
1.4 Modifying rank
I'm not really sure how to interpret this angry face... 😅 numpy has expand_dims too!
And I think
jax.numpy.newaxis
also works?1.4.1 Reshaping
I found the second sentence hard to follow. Would some punctuation and formatting help?
-1 can appear once in a
reshape
command. It tells the computer to figure out what goes there by following the rule that the total number of elements in the tensor must remain the same.Below I also suggest my personal understanding of -1.
-1 can appear once in a
reshape
command. Because the total number of elements in the reshaped tensor must remain the same, -1 stands for "everything else".1.5 Chapter Summary
This can be a pain to do consistently, but for functions that are also English words I like to format functions in code-style (i.e. like
sum
ormean
) to distinguish when I'm talking about code vs maths.1.6.2 Reductions
Just a suggestion: many undergraduate courses check code function by providing some test cases and example answers. It might be nice to provide an example input-output pair in Markdown code so people can check their work. e.g.
1.6.3 Broadcasting
outter -> outer
I had to read over this a few times before coming to an interpretation that accounted for every word. Is this what you're after?
If so, can I please suggest breaking up the question for more immediate understanding? It's more repetitive but people don't typically read textbooks for the prose.
You have a tensor of unknown rank A. You would like to perform two operations on it at once: firstly, subtracting 3.5 from every element; and secondly, subtracting 2.5 from every element. Your output should combine the results and should be a new tensor B with rank rank(A) + 1. Hint: the new axis of B should be last, and should have dimension 2.
(I originally sat wondering how subtracting 6 should give me dimension 2).