Ok, I have added import and changed a class name, here we have one more lost classes. Same unit test class I reffered to:
def test_gradient_stride(self):
self.layers[0] = self.MaxPooling(neighborhood=(2, 2), stride=(2, 2))
self.layers[2] = self.FullyConnected(12, self.categories, 0.)
difference = gradient_check(self.layers, self.input_tensor, self.label_tensor)
self.assertLessEqual(np.sum(difference), 1e-6)
def test_gradient_overlapping_stride(self):
self.layers[0] = self.MaxPooling(neighborhood=(2, 2), stride=(2, 1))
self.layers[2] = self.FullyConnected(24, self.categories, 0.)
difference = gradient_check(self.layers, self.input_tensor, self.label_tensor)
self.assertLessEqual(np.sum(difference), 1e-6)
def test_gradient_subsampling_stride(self):
self.layers[0] = self.MaxPooling(neighborhood=(2, 2), stride=(3, 2))
self.layers[2] = self.FullyConnected(6, self.categories, 0.)
As you can see multiple functions try to create instances of MaxPooling class and FullyConnected layers. The MaxPooling class is defined in the next cell:
# TODO: run as homework!
test = TestMaxPooling()
test.MaxPooling = MaxPoolLayer
But at the same time, there is no FullyConnected layer in the notebook and no assignment of it to the test case class. So while running a test case we got an error:
40 def test_gradient_stride(self):
41 self.layers[0] = self.MaxPooling(neighborhood=(2, 2), stride=(2, 2))
---> 42 self.layers[2] = self.FullyConnected(12, self.categories, 0.)
44 difference = gradient_check(self.layers, self.input_tensor, self.label_tensor)
46 self.assertLessEqual(np.sum(difference), 1e-6) AttributeError: 'TestMaxPooling' object has no attribute 'FullyConnected'
So, it looks like there should be a line like:
test.FullyConnected = FullyConnected
I can assume that it is just a normal dense layer which we also have done in the 1st notebook, but anyway could you please check it and fix it.