============================= 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 ......                                                  [ 15%]
tests/test_operators.py .................................                [ 33%]
tests/test_scalar.py ................................                    [ 50%]
tests/test_tensor.py .........................................xx....     [ 75%]
tests/test_tensor_data.py .x.....                                        [ 79%]
tests/test_tensor_general.py ................................F......     [100%]

=================================== FAILURES ===================================
____________________________ test_reduce[fast-fn1] _____________________________

fn = ('prod', <function MathTest._tests.<locals>.<lambda> at 0x746ed244bd00>, <function MathTestVariable._comp_testing.<locals>.<lambda> at 0x746ed244be20>)
backend = 'fast'

    @given(data())
>   @settings(max_examples=100)

tests/test_tensor_general.py:117: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_tensor_general.py:128: in test_reduce
    grad_check(tensor_fn, t1)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

f = <function MathTestVariable._comp_testing.<locals>.<lambda> at 0x746ed244be20>
vals = ([[[1.00 [[4.00] [[20.00] [46.00]] [[68.00] [83.00]] [2.00]] 1.66]]],)
x = [[[1.00 [[4.00] [[20.00] [46.00]] [[68.00] [83.00]] [2.00]] 1.66]]]
out = [69064040.63], ind = (1, 1, 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
            if abs(old) < 1e-5 and not operators.is_close(x.grad[ind], check):
                continue
>           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 (1, 1, 0): 34532020.31250779 vs 34532020.3229785
E           Falsifying example: test_reduce(
E               data=data(...),
E               fn=('prod', lambda ls: <unknown>, lambda t: <unknown>),
E               backend='fast',
E           )
E           Draw 1: [[[1.00 [[4.00] [[20.00] [46.00]] [[68.00] [83.00]] [2.00]] 1.66]]]

minitorch/tensor_functions.py:356: AssertionError
--------------------------------- JSON report ----------------------------------
report saved to: report.json
=========================== short test summary info ============================
FAILED tests/test_tensor_general.py::test_reduce[fast-fn1] - AssertionError: ...
================== 1 failed, 182 passed, 4 xfailed in 41.92s ===================