def test_Softmax():
    def init(input_shape, output_shape):
        return Softmax()

    generic_test_module_derivative_amount(init,
                                          mean_squared_loss,
                                          shape_generator=same_generator)
def test_MatrixMultModel():
    def init(input_shape, output_shape):
        return MatrixMult([input_shape[1], output_shape[1]])

    generic_test_module_optimize(init, mean_squared_loss)
    generic_test_module_derivative_amount(init,
                                          mean_squared_loss,
                                          shape_generator=alt_generator)
def generic_test_Convolution_derivative_amount(conv_cls):
    def shape_generator():
        return ([[1, 12, 12, 2], [0, 0, 0, 0]], [[1, 10, 10, 3], [0, 0, 0, 0]])

    def init_fnc(input_shape, output_shape):
        return conv_cls(input_shape[1:], 3, output_shape[-1])

    generic_test_module_derivative_amount(init_fnc, mean_squared_loss,
                                          shape_generator)
def generic_test_Pool_derivative_amount(pool):
    def shape_generator():
        return ([[1, 12, 12, 2], [0, 0, 0, 0]], [[1, 6, 6, 2], [0, 0, 0, 0]])

    def init_fnc(input_shape, output_shape):
        return pool(2)

    generic_test_module_derivative_amount(init_fnc,
                                          mean_squared_loss,
                                          shape_generator,
                                          ratio_skips=0.05)