Skip to content

Commit ddbede1

Browse files
task2 and 3
1 parent e281fed commit ddbede1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tasks.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,14 @@ def step(num):
3434

3535
# Your code here:
3636
# -----------------------------------------------
37-
def ReLU(input_array, cutoff=0):
37+
def ReLU(arr, cutoff=0):
3838
"""
39-
39+
Searches for values above cutoff in np array, changes them if exceeding it.
4040
"""
41-
return
41+
for x in arr:
42+
if arr[x] < cutoff:
43+
arr[x] = cutoff
44+
return arr
4245

4346

4447
# -----------------------------------------------
@@ -54,7 +57,9 @@ def ReLU(input_array, cutoff=0):
5457
# Your code here:
5558
# -----------------------------------------------
5659

57-
def neural_net_layer
60+
def neural_net_layer(arr_2d, arr_p):
61+
arr_new = numpy.matmul(arr_2d, arr_p)
62+
return ReLU(arr_new)
5863

5964

6065
------------------------------------------

0 commit comments

Comments
 (0)