Linear Algebra

Hi! I’m not sure what :eqref:eq_matrix_def is supposed to refer to in section 2.3.3

Hi @Briana_Brady, sorry for not rendered labels, we will fix it. It should point to the equation 2.3.2.

Thank you for your quick response!

Here in the Linear-Algebra-Exercises section’s 6th question, it is asked to
“Run A / A.sum(axis=1) and see what happens.” and find out why but I’m getting an error.

At first it said
AttributeError: ‘tensorflow.python.framework.ops.EagerTensor’ object has no attribute 'sum’

So I used reduce_sum and again it raised an error.

InvalidArgumentError: Incompatible shapes: [5,4] vs. [5] [Op:RealDiv]

Can you help me with this?

Thanking you in advance.

Hi @Sumanth, good question! The numerator and denominator need to have the same type. (Think of how the machine knows which axis to apply division. :wink: ) It is pretty common to see the shape mismatch in deep learning. Just check the document and find more details, for e.g. TF division here.

Hi, may I join the discussion :smiley: , since I also got the same problem trying to run that line, even with tf.math.divide. What I think the question is asking is: divide the matrix to an array, so for each row of the matrix, it is divided by the sum of that row, so I would suggest mine: A / tf.reshape(tf.reduce_sum(A,axis=1),(-1,1))

Hey @randomonlinedude, thanks for the great suggestion! Would you like to post a PR on our git and become a contributor?

1 Like

Thanks. Now it’s fixed. See comments in

@goldpiggy Hi, sorry for the late reply, I didnt see the notice :smiley: yes, if I can do something for this book, I would love to. Thank you for the work of your team and you :blush:

In the scalars section of this chapter, I attempted to write “import tensorflow as tf” and am now getting this error: “[WinError 193] %1 is not a valid Win32 application”. It seems like some library I have downloaded may be made for 32-bit only. Does anyone know any fixes?

Hello, thanks for writing this book. I have a small doubt. In the book, its written axis=1 represents along the column. So if I have:
A = tf.reshape(tf.range(20), shape=(5,4))
tf.reduce_sum(A, axis=1)
# The output comes to be of shape [5] why? If we are doing along with the columns
# shouldn’t the answer be [4] as there are 4 columns and we are adding along
# the columns.

  1. (A dot B) dot C = Theta(2^{10+16+5} + 2^{10+5+14}) = Theta(2^{31})
    A dot (B dot C) = Theta(2^{16+5+14} + 2^{10+16+14}) = Theta(2^{40})

Hi, where can I find answers to exercises?