I was working on exercise2 of this lab, but got stuck on building a dense layer subroutine.
Can someone help me out?
{mentor edit: code removed}
Quick Check
x_tst = 0.1np.arange(1,3,1).reshape(2,) # (1 examples, 2 features)
W_tst = 0.1 np.arange(1,7,1).reshape(2,3) # (2 input features, 3 output features)
b_tst = 0.1*np.arange(1,4,1).reshape(3,) # (3 features)
A_tst = my_dense(x_tst, W_tst, b_tst, sigmoid)
print(A_tst)
I got an output of [1. 1. 1.] but the expected output is
[0.54735762 0.57932425 0.61063923]
I tried a few times but still can’t get the expected output…
Thank you for your help!
Carolina
TMosh
January 19, 2024, 2:42am
2
Nothing in the instructions tells you that you need to test for the type of activation function.
‘g’ is a function pointer. Not a text string.
You just use g(…) as-is. Nothing fancy.
TMosh
January 19, 2024, 2:43am
3
Also, in the future, please don’t post your code on the forum. That’s not allowed by the Code of Conduct.
If a mentor needs to see your code, we’ll contact you with instructions.
TMosh
January 19, 2024, 2:44am
4
Other tips:
Do not add the numpy import. That’s already done in the first cell in the notebook.
Do not add any code except inside the “START CODE HERE” area.
Every time you open the notebook, you have to run all of the cells. That is how the workspace is configured.
Hi TMosh,
Thank you for responding! Got it I will pay attention on posting code in the future.
How can I get help with a mentor about this problem?
I’m really stuck on this…
Thanks,
Carolina
TMosh
January 19, 2024, 3:40am
6
I think I’ve already given you the necessary hints to fix the issue.
Read my first reply again.
TMosh
January 19, 2024, 3:41am
7
Delete the if-test. It’s not needed.