========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= test session starts ==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0
rootdir: /workspace/minitorch
configfile: setup.cfg
plugins: anyio-4.13.0, metadata-3.1.1, json-report-1.5.0, cov-7.1.0, hypothesis-6.54.0
collected 187 items

tests/test_autodiff.py ........                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  [  4%]
tests/test_conv.py .......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       [  8%]
tests/test_module.py ...x..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      [ 11%]
tests/test_modules.py ..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [ 12%]
tests/test_nn.py .F....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          [ 15%]
tests/test_operators.py .......FFFFF.F...................                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        [ 33%]
tests/test_scalar.py ..........................FF....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            [ 50%]
tests/test_tensor.py ........................F.F...FF.........xx....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [ 75%]
tests/test_tensor_data.py .x.....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                [ 79%]
tests/test_tensor_general.py ........................FFF....FF......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             [100%]

=============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== FAILURES ===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_max _______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

    @pytest.mark.task4_4
>   @given(tensors(shape=(2, 3, 4)))

tests/test_nn.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

t = [[[0.00 [[0.00 [[0.00 [[0.00] [[0.00 [0.00 [0.00 [0.00] [[0.00] [0.00] [0.00] [0.00]] [[0.00] [0.00] [0.00] [0.00]] [0.00] 0.00] 0.00] 0.00]] [0.00]] 0.00]] 0.00]] 0.00]]]

    @pytest.mark.task4_4
    @given(tensors(shape=(2, 3, 4)))
    def test_max(t: Tensor) -> None:
        # TODO: Implement for Task 4.4.
>       raise NotImplementedError('Need to implement for Task 4.4')
E       NotImplementedError: Need to implement for Task 4.4
E       Falsifying example: test_max(
E           t=[[[0.00 [[0.00 [[0.00 [[0.00] [[0.00 [0.00 [0.00 [0.00] [[0.00] [0.00] [0.00] [0.00]] [[0.00] [0.00] [0.00] [0.00]] [0.00] 0.00] 0.00] 0.<response clipped><NOTE>Due to the max output limit, only part of the full response has been shown to you.</NOTE> _ _ _ _ _ _
tests/test_tensor_general.py:98: in test_one_derivative
    grad_check(tensor_fn, t1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

f = <function MathTest.relu at 0x75b5d698bf40>, vals = ([0.00],), x = [0.00], out = [0.00], ind = (0,)

    def grad_check(f: Any, *vals: Tensor) -> None:
        for x in vals:
            x.requires_grad_(True)
            x.zero_grad_()
        out = f(*vals).sum()
        out.backward()
        for x in vals:
            ind = x._tensor.sample()
            old = x[ind]
            x[ind] = old + 1e-6
            up = f(*vals).sum().item()
            x[ind] = old - 1e-6
            down = f(*vals).sum().item()
            x[ind] = old
            check = (up - down) / (2e-6)
            assert x.grad is not None
>           assert operators.is_close(x.grad[ind], check), f'Gradient check failed at {ind}: {x.grad[ind]} vs {check}'
E           AssertionError: Gradient check failed at (0,): 0.0 vs 0.5
E           Falsifying example: test_one_derivative(
E               data=data(...), fn=('relu', relu, relu), backend='fast',
E           )
E           Draw 1: [0.00]

minitorch/tensor_functions.py:334: AssertionError
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_reduce[fast-fn0] _________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
  + Exception Group Traceback (most recent call last):
  |   File "/workspace/minitorch/tests/test_tensor_general.py", line 117, in test_reduce
  |     @settings(max_examples=100)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/hypothesis/core.py", line 1257, in wrapped_test
  |     raise the_error_hypothesis_found
  | exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/workspace/minitorch/tests/test_tensor_general.py", line 128, in test_reduce
    |     grad_check(tensor_fn, t1)
    |   File "/workspace/minitorch/minitorch/tensor_functions.py", line 322, in grad_check
    |     out = f(*vals).sum()
    |   File "/workspace/minitorch/minitorch/testing.py", line 104, in <lambda>
    |     red_arg = (('sum', lambda ls: operators.sum(ls)), ('prod', lambda ls: operators.prod(ls)))
    |   File "/workspace/minitorch/minitorch/operators.py", line 154, in sum
    |     return reduce(add, 0.0)(ls)
    |   File "/workspace/minitorch/minitorch/operators.py", line 147, in apply
    |     for x in ls:
    |   File "/workspace/minitorch/minitorch/tensor.py", line 167, in __getitem__
    |     return self._tensor.get(key2)
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 198, in get
    |     return float(self._storage[self.index(key)])
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 182, in index
    |     raise IndexingError(f'Index {index} must have {self.dims} dimensions')
    | minitorch.tensor_data.IndexingError: Index (0,) must have 2 dimensions
    | Falsifying example: test_reduce(
    |     data=data(...),
    |     fn=('sum', lambda ls: <unknown>, lambda ls: <unknown>),
    |     backend='fast',
    | )
    | Draw 1: [[0.00]]
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/workspace/minitorch/tests/test_tensor_general.py", line 128, in test_reduce
    |     grad_check(tensor_fn, t1)
    |   File "/workspace/minitorch/minitorch/tensor_functions.py", line 322, in grad_check
    |     out = f(*vals).sum()
    |   File "/workspace/minitorch/minitorch/testing.py", line 104, in <lambda>
    |     red_arg = (('sum', lambda ls: operators.sum(ls)), ('prod', lambda ls: operators.prod(ls)))
    |   File "/workspace/minitorch/minitorch/operators.py", line 154, in sum
    |     return reduce(add, 0.0)(ls)
    |   File "/workspace/minitorch/minitorch/operators.py", line 147, in apply
    |     for x in ls:
    |   File "/workspace/minitorch/minitorch/tensor.py", line 167, in __getitem__
    |     return self._tensor.get(key2)
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 198, in get
    |     return float(self._storage[self.index(key)])
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 185, in index
    |     raise IndexingError(f'Index {index} out of bounds for shape {self.shape}')
    | minitorch.tensor_data.IndexingError: Index (1,) out of bounds for shape (1,)
    | Falsifying example: test_reduce(
    |     data=data(...),
    |     fn=('sum', lambda ls: <unknown>, lambda ls: <unknown>),
    |     backend='fast',
    | )
    | Draw 1: [0.00]
    +------------------------------------
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ test_reduce[fast-fn1] _________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________
  + Exception Group Traceback (most recent call last):
  |   File "/workspace/minitorch/tests/test_tensor_general.py", line 117, in test_reduce
  |     @settings(max_examples=100)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/hypothesis/core.py", line 1257, in wrapped_test
  |     raise the_error_hypothesis_found
  | exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/workspace/minitorch/tests/test_tensor_general.py", line 128, in test_reduce
    |     grad_check(tensor_fn, t1)
    |   File "/workspace/minitorch/minitorch/tensor_functions.py", line 322, in grad_check
    |     out = f(*vals).sum()
    |   File "/workspace/minitorch/minitorch/testing.py", line 104, in <lambda>
    |     red_arg = (('sum', lambda ls: operators.sum(ls)), ('prod', lambda ls: operators.prod(ls)))
    |   File "/workspace/minitorch/minitorch/operators.py", line 158, in prod
    |     return reduce(mul, 1.0)(ls)
    |   File "/workspace/minitorch/minitorch/operators.py", line 147, in apply
    |     for x in ls:
    |   File "/workspace/minitorch/minitorch/tensor.py", line 167, in __getitem__
    |     return self._tensor.get(key2)
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 198, in get
    |     return float(self._storage[self.index(key)])
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 182, in index
    |     raise IndexingError(f'Index {index} must have {self.dims} dimensions')
    | minitorch.tensor_data.IndexingError: Index (0,) must have 2 dimensions
    | Falsifying example: test_reduce(
    |     data=data(...),
    |     fn=('prod', lambda ls: <unknown>, lambda ls: <unknown>),
    |     backend='fast',
    | )
    | Draw 1: [[0.00]]
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/workspace/minitorch/tests/test_tensor_general.py", line 128, in test_reduce
    |     grad_check(tensor_fn, t1)
    |   File "/workspace/minitorch/minitorch/tensor_functions.py", line 322, in grad_check
    |     out = f(*vals).sum()
    |   File "/workspace/minitorch/minitorch/testing.py", line 104, in <lambda>
    |     red_arg = (('sum', lambda ls: operators.sum(ls)), ('prod', lambda ls: operators.prod(ls)))
    |   File "/workspace/minitorch/minitorch/operators.py", line 158, in prod
    |     return reduce(mul, 1.0)(ls)
    |   File "/workspace/minitorch/minitorch/operators.py", line 147, in apply
    |     for x in ls:
    |   File "/workspace/minitorch/minitorch/tensor.py", line 167, in __getitem__
    |     return self._tensor.get(key2)
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 198, in get
    |     return float(self._storage[self.index(key)])
    |   File "/workspace/minitorch/minitorch/tensor_data.py", line 185, in index
    |     raise IndexingError(f'Index {index} out of bounds for shape {self.shape}')
    | minitorch.tensor_data.IndexingError: Index (1,) out of bounds for shape (1,)
    | Falsifying example: test_reduce(
    |     data=data(...),
    |     fn=('prod', lambda ls: <unknown>, lambda ls: <unknown>),
    |     backend='fast',
    | )
    | Draw 1: [0.00]
    +------------------------------------
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================= short test summary info ========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
FAILED tests/test_nn.py::test_max - NotImplementedError: Need to implement for Task 4.4
FAILED tests/test_operators.py::test_sigmoid - NotImplementedError: Need to implement for Task 0.2
FAILED tests/test_operators.py::test_transitive - NotImplementedError: Need to implement for Task 0.2
FAILED tests/test_operators.py::test_symmetric - NotImplementedError: Need to implement for Task 0.2
FAILED tests/test_operators.py::test_distribute - NotImplementedError: Need to implement for Task 0.2
FAILED tests/test_operators.py::test_other - NotImplementedError: Need to implement for Task 0.2
FAILED tests/test_operators.py::test_sum_distribute - NotImplementedError: Need to implement for Task 0.3
FAILED tests/test_scalar.py::test_one_derivative[fn9] - AssertionError: Derivative check failed for arg 0: 1000000.0 vs Scalar(10245134.048996)
FAILED tests/test_scalar.py::test_one_derivative[fn10] - AssertionError: Derivative check failed for arg 0: 0.0 vs Scalar(0.500000)
FAILED tests/test_tensor.py::test_one_derivative[fn8] - TypeError: unsupported operand type(s) for -: 'float' and 'Tensor'
FAILED tests/test_tensor.py::test_one_derivative[fn10] - AssertionError: Gradient check failed at (0,): 0.0 vs 0.5
FAILED tests/test_tensor.py::test_grad_reduce[fn0] - exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
FAILED tests/test_tensor.py::test_grad_reduce[fn1] - exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
FAILED tests/test_tensor_general.py::test_one_derivative[fast-fn8] - TypeError: unsupported operand type(s) for -: 'float' and 'Tensor'
FAILED tests/test_tensor_general.py::test_one_derivative[fast-fn9] - AssertionError: Gradient check failed at (1, 1, 0): 1000000.0 vs 10245134.048995974
FAILED tests/test_tensor_general.py::test_one_derivative[fast-fn10] - AssertionError: Gradient check failed at (0,): 0.0 vs 0.5
FAILED tests/test_tensor_general.py::test_reduce[fast-fn0] - exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
FAILED tests/test_tensor_general.py::test_reduce[fast-fn1] - exceptiongroup.ExceptionGroup: Hypothesis found 2 distinct failures. (2 sub-exceptions)
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== 18 failed, 165 passed, 4 xfailed in 44.72s ==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
[The command completed with exit code 1.]
[Current working directory: /workspace/minitorch]
[Python interpreter: /usr/bin/python]
[Command finished with exit code 1]