Running TestBasic.test_repack_attrs in 32-bit environments
detrout opened this issue · comments
The test "TestBasic.test_repack_attrs" failed on Debian's 32-bit architectures, i386 and armhf's test runners.
The full armhf log is here:
https://ci.debian.net/data/autopkgtest/testing/armhf/p/python-sparse/10174305/log.gz
the full i386 log is here:
https://ci.debian.net/data/autopkgtest/testing/i386/p/python-sparse/10174306/log.gz
The relevant stack trace from the armhf log is below.
I'm guessing the most important part is this:
TypeError: Invalid store of [2 x i32] to [2 x i64] in <sparse._coo.numba_extension.COOModel object at 0xef22f4f0> (trying to write member #2)
and I'm wondering if theres an assumption about the default int that's invalid on the 32-bit architectures.
=================================== FAILURES ===================================
_________________________ TestBasic.test_repack_attrs __________________________
fmt_ = 'lowering "{inst}" at {loc}', args = ()
kwargs = {'inst': <numba.core.ir.Assign object at 0xedb95b80>, 'loc': Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None)}
errcls = functools.partial(<class 'numba.core.errors.LoweringError'>, loc=Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None))
loc = Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None)
newerr = LoweringError('Failed in nopython mode pipeline (step: nopython mode backend)\nInvalid store of [2 x i32] to [2 x i64]....py:64)], kws=(), vararg=None)" at /tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py (64)')
tb = None
@contextlib.contextmanager
def new_error_context(fmt_, *args, **kwargs):
"""
A contextmanager that prepend contextual information to any exception
raised within. If the exception type is not an instance of NumbaError,
it will be wrapped into a InternalError. The exception class can be
changed by providing a "errcls_" keyword argument with the exception
constructor.
The first argument is a message that describes the context. It can be a
format string. If there are additional arguments, it will be used as
``fmt_.format(*args, **kwargs)`` to produce the final message string.
"""
errcls = kwargs.pop('errcls_', InternalError)
loc = kwargs.get('loc', None)
if loc is not None and not loc.filename.startswith(_numba_path):
loc_info.update(kwargs)
try:
> yield
/usr/lib/python3/dist-packages/numba/core/errors.py:744:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
block = <ir.Block at /tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py (64)>
def lower_block(self, block):
"""
Lower the given block.
"""
self.pre_block(block)
for inst in block.body:
self.loc = inst.loc
defaulterrcls = partial(LoweringError, loc=self.loc)
with new_error_context('lowering "{inst}" at {loc}', inst=inst,
loc=self.loc, errcls_=defaulterrcls):
> self.lower_inst(inst)
/usr/lib/python3/dist-packages/numba/core/lowering.py:230:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
inst = <numba.core.ir.Assign object at 0xedb95b80>
def lower_inst(self, inst):
# Set debug location for all subsequent LL instructions
self.debuginfo.mark_location(self.builder, self.loc)
self.debug_print(str(inst))
if isinstance(inst, ir.Assign):
ty = self.typeof(inst.target.name)
> val = self.lower_assign(ty, inst)
/usr/lib/python3/dist-packages/numba/core/lowering.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
ty = COOType[float64, int32, 2]
inst = <numba.core.ir.Assign object at 0xedb95b80>
def lower_assign(self, ty, inst):
value = inst.value
# In nopython mode, closure vars are frozen like globals
if isinstance(value, (ir.Const, ir.Global, ir.FreeVar)):
res = self.context.get_constant_generic(self.builder, ty,
value.value)
self.incref(ty, res)
return res
elif isinstance(value, ir.Expr):
> return self.lower_expr(ty, value)
/usr/lib/python3/dist-packages/numba/core/lowering.py:502:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
resty = COOType[float64, int32, 2]
expr = call $4load_method.1(coords, data, shape, func=$4load_method.1, args=[Var(coords, test_coo_numba.py:64), Var(data, test_coo_numba.py:64), Var(shape, test_coo_numba.py:64)], kws=(), vararg=None)
def lower_expr(self, resty, expr):
if expr.op == 'binop':
return self.lower_binop(resty, expr, expr.fn)
elif expr.op == 'inplace_binop':
lty = self.typeof(expr.lhs.name)
if lty.mutable:
return self.lower_binop(resty, expr, expr.fn)
else:
# inplace operators on non-mutable types reuse the same
# definition as the corresponding copying operators.)
return self.lower_binop(resty, expr, expr.immutable_fn)
elif expr.op == 'unary':
val = self.loadvar(expr.value.name)
typ = self.typeof(expr.value.name)
func_ty = self.context.typing_context.resolve_value_type(expr.fn)
# Get function
signature = self.fndesc.calltypes[expr]
impl = self.context.get_function(func_ty, signature)
# Convert argument to match
val = self.context.cast(self.builder, val, typ, signature.args[0])
res = impl(self.builder, [val])
res = self.context.cast(self.builder, res,
signature.return_type, resty)
return res
elif expr.op == 'call':
> res = self.lower_call(resty, expr)
/usr/lib/python3/dist-packages/numba/core/lowering.py:1023:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
resty = COOType[float64, int32, 2]
expr = call $4load_method.1(coords, data, shape, func=$4load_method.1, args=[Var(coords, test_coo_numba.py:64), Var(data, test_coo_numba.py:64), Var(shape, test_coo_numba.py:64)], kws=(), vararg=None)
def lower_call(self, resty, expr):
signature = self.fndesc.calltypes[expr]
self.debug_print("# lower_call: expr = {0}".format(expr))
if isinstance(signature.return_type, types.Phantom):
return self.context.get_dummy_value()
fnty = self.typeof(expr.func.name)
if isinstance(fnty, types.ObjModeDispatcher):
res = self._lower_call_ObjModeDispatcher(fnty, expr, signature)
elif isinstance(fnty, types.ExternalFunction):
res = self._lower_call_ExternalFunction(fnty, expr, signature)
elif isinstance(fnty, types.ExternalFunctionPointer):
res = self._lower_call_ExternalFunctionPointer(
fnty, expr, signature)
elif isinstance(fnty, types.RecursiveCall):
res = self._lower_call_RecursiveCall(fnty, expr, signature)
elif isinstance(fnty, types.FunctionType):
res = self._lower_call_FunctionType(fnty, expr, signature)
else:
> res = self._lower_call_normal(fnty, expr, signature)
/usr/lib/python3/dist-packages/numba/core/lowering.py:761:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.lowering.Lower object at 0xedb95460>
fnty = Function(<class 'sparse._coo.core.COO'>)
expr = call $4load_method.1(coords, data, shape, func=$4load_method.1, args=[Var(coords, test_coo_numba.py:64), Var(data, test_coo_numba.py:64), Var(shape, test_coo_numba.py:64)], kws=(), vararg=None)
signature = (array(int32, 2d, C), array(float64, 1d, C), UniTuple(int32 x 2)) -> COOType[float64, int32, 2]
def _lower_call_normal(self, fnty, expr, signature):
# Normal function resolution
self.debug_print("# calling normal function: {0}".format(fnty))
self.debug_print("# signature: {0}".format(signature))
if isinstance(fnty, types.ObjModeDispatcher):
argvals = expr.func.args
else:
argvals = self.fold_call_args(
fnty, signature, expr.args, expr.vararg, expr.kws,
)
impl = self.context.get_function(fnty, signature)
if signature.recvr:
# The "self" object is passed as the function object
# for bounded function
the_self = self.loadvar(expr.func.name)
# Prepend the self reference
argvals = [the_self] + list(argvals)
> res = impl(self.builder, argvals, self.loc)
/usr/lib/python3/dist-packages/numba/core/lowering.py:994:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <wrapped <wrapped <function impl_COO at 0xeea464f0>>>
builder = <llvmlite.llvmpy.core.Builder object at 0xeda50958>
args = (<ir.LoadInstr '.68' of type '{i8*, i8*, i32, i32, i32*, [2 x i32], [2 x i32]}', opname 'load', operands [<ir.AllocaIn...pe '[2 x i32]', opname 'load', operands [<ir.AllocaInstr 'shape' of type '[2 x i32]*', opname 'alloca', operands ()>]>)
loc = Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None)
def __call__(self, builder, args, loc=None):
> res = self._imp(self._context, builder, self._sig, args, loc=loc)
/usr/lib/python3/dist-packages/numba/core/base.py:1164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<numba.core.cpu.CPUContext object at 0xed772490>, <llvmlite.llvmpy.core.Builder object at 0xeda50958>, (array(int32, ...e '[2 x i32]', opname 'load', operands [<ir.AllocaInstr 'shape' of type '[2 x i32]*', opname 'alloca', operands ()>]>))
kwargs = {}
def wrapper(*args, **kwargs):
kwargs.pop('loc') # drop unused loc
> return fn(*args, **kwargs)
/usr/lib/python3/dist-packages/numba/core/base.py:1194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
context = <numba.core.cpu.CPUContext object at 0xed772490>
builder = <llvmlite.llvmpy.core.Builder object at 0xeda50958>
sig = (array(int32, 2d, C), array(float64, 1d, C), UniTuple(int32 x 2)) -> COOType[float64, int32, 2]
args = (<ir.LoadInstr '.68' of type '{i8*, i8*, i32, i32, i32*, [2 x i32], [2 x i32]}', opname 'load', operands [<ir.AllocaIn...pe '[2 x i32]', opname 'load', operands [<ir.AllocaInstr 'shape' of type '[2 x i32]*', opname 'alloca', operands ()>]>)
@lower_builtin(COO, types.Any, types.Any, types.Any)
def impl_COO(context, builder, sig, args):
typ = sig.return_type
coords, data, shape = args
coo = cgutils.create_struct_proxy(typ)(context, builder)
coo.coords = coords
coo.data = data
> coo.shape = shape
/usr/lib/python3/dist-packages/sparse/_coo/numba_extension.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.cgutils.ValueStructProxy_COOType[float64, int32, 2] object at 0xeda1d880>
field = 'shape'
value = <ir.LoadInstr '.70' of type '[2 x i32]', opname 'load', operands [<ir.AllocaInstr 'shape' of type '[2 x i32]*', opname 'alloca', operands ()>]>
def __setattr__(self, field, value):
"""
Store the LLVM *value* into the named *field*.
"""
if field.startswith('_'):
return super(_StructProxy, self).__setattr__(field, value)
> self[self._datamodel.get_field_position(field)] = value
/usr/lib/python3/dist-packages/numba/core/cgutils.py:164:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <numba.core.cgutils.ValueStructProxy_COOType[float64, int32, 2] object at 0xeda1d880>
index = 2
value = <ir.LoadInstr '.70' of type '[2 x i32]', opname 'load', operands [<ir.AllocaInstr 'shape' of type '[2 x i32]*', opname 'alloca', operands ()>]>
def __setitem__(self, index, value):
"""
Store the LLVM *value* into the field at *index*.
"""
ptr = self._get_ptr_by_index(index)
value = self._cast_member_from_value(index, value)
if value.type != ptr.type.pointee:
if (is_pointer(value.type) and is_pointer(ptr.type.pointee)
and value.type.pointee == ptr.type.pointee.pointee):
# Differ by address-space only
# Auto coerce it
value = self._context.addrspacecast(self._builder,
value,
ptr.type.pointee.addrspace)
else:
> raise TypeError("Invalid store of {value.type} to "
"{ptr.type.pointee} in "
"{self._datamodel} "
"(trying to write member #{index})"
.format(value=value, ptr=ptr, self=self,
index=index))
E TypeError: Invalid store of [2 x i32] to [2 x i64] in <sparse._coo.numba_extension.COOModel object at 0xef22f4f0> (trying to write member #2)
/usr/lib/python3/dist-packages/numba/core/cgutils.py:188: TypeError
During handling of the above exception, another exception occurred:
self = <test_coo_numba.TestBasic object at 0xef253220>
def test_repack_attrs(self):
@numba.njit
def pack(coords, data, shape):
return sparse.COO(coords, data, shape)
# repacking fill_value isn't possible yet
c1 = sparse.COO(np.eye(3))
> c2 = pack(c1.coords, c1.data, c1.shape)
tests/test_coo_numba.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:433: in _compile_for_args
raise e
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:366: in _compile_for_args
return self.compile(tuple(argtypes))
/usr/lib/python3/dist-packages/numba/core/compiler_lock.py:32: in _acquire_compile_lock
return func(*args, **kwargs)
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:857: in compile
cres = self._compiler.compile(args, return_type)
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:77: in compile
status, retval = self._compile_cached(args, return_type)
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:91: in _compile_cached
retval = self._compile_core(args, return_type)
/usr/lib/python3/dist-packages/numba/core/dispatcher.py:104: in _compile_core
cres = compiler.compile_extra(self.targetdescr.typing_context,
/usr/lib/python3/dist-packages/numba/core/compiler.py:602: in compile_extra
return pipeline.compile_extra(func)
/usr/lib/python3/dist-packages/numba/core/compiler.py:352: in compile_extra
return self._compile_bytecode()
/usr/lib/python3/dist-packages/numba/core/compiler.py:414: in _compile_bytecode
return self._compile_core()
/usr/lib/python3/dist-packages/numba/core/compiler.py:394: in _compile_core
raise e
/usr/lib/python3/dist-packages/numba/core/compiler.py:385: in _compile_core
pm.run(self.state)
/usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:339: in run
raise patched_exception
/usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:330: in run
self._runPass(idx, pass_inst, state)
/usr/lib/python3/dist-packages/numba/core/compiler_lock.py:32: in _acquire_compile_lock
return func(*args, **kwargs)
/usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:289: in _runPass
mutated |= check(pss.run_pass, internal_state)
/usr/lib/python3/dist-packages/numba/core/compiler_machinery.py:262: in check
mangled = func(compiler_state)
/usr/lib/python3/dist-packages/numba/core/typed_passes.py:449: in run_pass
NativeLowering().run_pass(state)
/usr/lib/python3/dist-packages/numba/core/typed_passes.py:373: in run_pass
lower.lower()
/usr/lib/python3/dist-packages/numba/core/lowering.py:136: in lower
self.lower_normal_function(self.fndesc)
/usr/lib/python3/dist-packages/numba/core/lowering.py:190: in lower_normal_function
entry_block_tail = self.lower_function_body()
/usr/lib/python3/dist-packages/numba/core/lowering.py:216: in lower_function_body
self.lower_block(block)
/usr/lib/python3/dist-packages/numba/core/lowering.py:230: in lower_block
self.lower_inst(inst)
/usr/lib/python3.9/contextlib.py:135: in __exit__
self.gen.throw(type, value, traceback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
fmt_ = 'lowering "{inst}" at {loc}', args = ()
kwargs = {'inst': <numba.core.ir.Assign object at 0xedb95b80>, 'loc': Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None)}
errcls = functools.partial(<class 'numba.core.errors.LoweringError'>, loc=Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None))
loc = Loc(filename=/tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py, line=64, col=None)
newerr = LoweringError('Failed in nopython mode pipeline (step: nopython mode backend)\nInvalid store of [2 x i32] to [2 x i64]....py:64)], kws=(), vararg=None)" at /tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py (64)')
tb = None
@contextlib.contextmanager
def new_error_context(fmt_, *args, **kwargs):
"""
A contextmanager that prepend contextual information to any exception
raised within. If the exception type is not an instance of NumbaError,
it will be wrapped into a InternalError. The exception class can be
changed by providing a "errcls_" keyword argument with the exception
constructor.
The first argument is a message that describes the context. It can be a
format string. If there are additional arguments, it will be used as
``fmt_.format(*args, **kwargs)`` to produce the final message string.
"""
errcls = kwargs.pop('errcls_', InternalError)
loc = kwargs.get('loc', None)
if loc is not None and not loc.filename.startswith(_numba_path):
loc_info.update(kwargs)
try:
yield
except NumbaError as e:
e.add_context(_format_msg(fmt_, args, kwargs))
raise
except Exception as e:
newerr = errcls(e).add_context(_format_msg(fmt_, args, kwargs))
tb = sys.exc_info()[2] if numba.core.config.FULL_TRACEBACKS else None
> raise newerr.with_traceback(tb)
E numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
E Invalid store of [2 x i32] to [2 x i64] in <sparse._coo.numba_extension.COOModel object at 0xef22f4f0> (trying to write member #2)
E
E File "tests/test_coo_numba.py", line 64:
E def pack(coords, data, shape):
E return sparse.COO(coords, data, shape)
E ^
E
E During: lowering "$12call_method.5 = call $4load_method.1(coords, data, shape, func=$4load_method.1, args=[Var(coords, test_coo_numba.py:64), Var(data, test_coo_numba.py:64), Var(shape, test_coo_numba.py:64)], kws=(), vararg=None)" at /tmp/autopkgtest-lxc.4e5okpan/downtmp/autopkgtest_tmp/tests/test_coo_numba.py (64)
/usr/lib/python3/dist-packages/numba/core/errors.py:751: LoweringError
=========================== short test summary info ============================
FAILED tests/test_coo_numba.py::TestBasic::test_repack_attrs - numba.core.err...```
**To Reproduce**
Run test ```test_repack_attrs```
**Expected behavior**
Test passes
**System**
- OS and version: Debian unstable
- `sparse` version 0.11.2
- NumPy version 1.19.4
- Numba version 0.52.0
**Additional context**
It does seem to be a problem with 32 bit systems. I can run the test on a 64 system without a problem.
Hi.
I just back ported your patch and can release it that way. I thought there was a different problem flushed out by doing the build on a 32-bit system, but I think it's unimportant.
In trying to test the patch I found more test failures that hadn't show up earlier when building on a 32-bit arm system. After reading through them I think it looks like they're all the doc tests which are getting confused by different default integer sizes.
I think the reason they didn't show up earlier is the sparse package gets built on a 64 bit machine, and during the build process all the tests in the source tree get run.
Later the Debian CI framework runs just the tests from sparse/tests in a chroot of for all the supported architectures. (Though frequently they use 32-bit chroots running on faster 64-bit cpus), and I think that skips the doctests.
============================================================================ FAILURES =============================================================================
_______________________________________________________________ [doctest] sparse._common.full_like ________________________________________________________________
1384
1385 Returns
1386 -------
1387 out : SparseArray
1388 Array of `fill_value` with the same shape and type as `a`.
1389
1390 Examples
1391 --------
1392 >>> x = np.ones((2, 3), dtype='i8')
1393 >>> full_like(x, 9.0).todense() # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[9, 9, 9],
[9, 9, 9]])
Got:
array([[9, 9, 9],
[9, 9, 9]], dtype=int64)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_common.py:1393: DocTestFailure
_______________________________________________________________ [doctest] sparse._common.ones_like ________________________________________________________________
1537
1538 Returns
1539 -------
1540 out : SparseArray
1541 Array of ones with the same shape and type as `a`.
1542
1543 Examples
1544 --------
1545 >>> x = np.ones((2, 3), dtype='i8')
1546 >>> ones_like(x).todense() # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[1, 1, 1],
[1, 1, 1]])
Got:
array([[1, 1, 1],
[1, 1, 1]], dtype=int64)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_common.py:1546: DocTestFailure
_______________________________________________________________ [doctest] sparse._common.zeros_like _______________________________________________________________
1461
1462 Returns
1463 -------
1464 out : SparseArray
1465 Array of zeros with the same shape and type as `a`.
1466
1467 Examples
1468 --------
1469 >>> x = np.ones((2, 3), dtype='i8')
1470 >>> zeros_like(x).todense() # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[0, 0, 0],
[0, 0, 0]])
Got:
array([[0, 0, 0],
[0, 0, 0]], dtype=int64)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_common.py:1470: DocTestFailure
____________________________________________________________________ [doctest] sparse._dok.DOK ____________________________________________________________________
056 <DOK: shape=(5, 5), dtype=int64, nnz=4, fill_value=0>
057
058 You can convert :obj:`DOK` arrays to :obj:`COO` arrays, or :obj:`numpy.ndarray`
059 objects.
060
061 >>> from sparse import COO
062 >>> s3 = COO(s2)
063 >>> s3
064 <COO: shape=(5, 5), dtype=int64, nnz=4, fill_value=0>
065 >>> s2.todense() # doctest: +NORMALIZE_WHITESPACE
Differences (unified diff with -expected +actual):
@@ -3,3 +3,3 @@
[0, 6, 7, 0, 0],
[0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0]])
+ [0, 0, 0, 0, 0]], dtype=int64)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_dok.py:65: DocTestFailure
____________________________________________________________ [doctest] sparse._slicing.sanitize_index _____________________________________________________________
144 Sanitize the elements for indexing along one axis
145 >>> sanitize_index([2, 3, 5])
146 array([2, 3, 5])
147 >>> sanitize_index([True, False, True, False])
Expected:
array([0, 2])
Got:
array([0, 2], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_slicing.py:147: DocTestFailure
______________________________________________________________ [doctest] sparse._coo.common.argwhere ______________________________________________________________
586
587 See Also
588 --------
589 :obj:`where`, :obj:`COO.nonzero`
590
591 Examples
592 --------
593 >>> import sparse
594 >>> x = sparse.COO(np.arange(6).reshape((2, 3)))
595 >>> sparse.argwhere(x > 1)
Differences (unified diff with -expected +actual):
@@ -2,3 +2,3 @@
[1, 0],
[1, 1],
- [1, 2]])
+ [1, 2]], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/common.py:595: DocTestFailure
_________________________________________________________________ [doctest] sparse._coo.core.COO __________________________________________________________________
070 You can create :obj:`COO` objects from Numpy arrays.
071
072 >>> x = np.eye(4, dtype=np.uint8)
073 >>> x[2, 3] = 5
074 >>> s = COO.from_numpy(x)
075 >>> s
076 <COO: shape=(4, 4), dtype=uint8, nnz=5, fill_value=0>
077 >>> s.data # doctest: +NORMALIZE_WHITESPACE
078 array([1, 1, 1, 5, 1], dtype=uint8)
079 >>> s.coords # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[0, 1, 2, 2, 3],
[0, 1, 2, 3, 3]])
Got:
array([[0, 1, 2, 2, 3],
[0, 1, 2, 3, 3]], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:79: DocTestFailure
__________________________________________________________ [doctest] sparse._coo.core.COO._sort_indices ___________________________________________________________
1542 Sorts the :obj:`COO.coords` attribute. Also sorts the data in
1543 :obj:`COO.data` to match.
1544
1545 Examples
1546 --------
1547 >>> coords = np.array([[1, 2, 0]], dtype=np.uint8)
1548 >>> data = np.array([4, 1, 3], dtype=np.uint8)
1549 >>> s = COO(coords, data)
1550 >>> s._sort_indices()
1551 >>> s.coords # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[0, 1, 2]])
Got:
array([[0, 1, 2]], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:1551: DocTestFailure
_________________________________________________________ [doctest] sparse._coo.core.COO._sum_duplicates __________________________________________________________
1570 --------
1571 scipy.sparse.coo_matrix.sum_duplicates : Equivalent Scipy function.
1572
1573 Examples
1574 --------
1575 >>> coords = np.array([[0, 1, 1, 2]], dtype=np.uint8)
1576 >>> data = np.array([6, 5, 2, 2], dtype=np.uint8)
1577 >>> s = COO(coords, data)
1578 >>> s._sum_duplicates()
1579 >>> s.coords # doctest: +NORMALIZE_WHITESPACE
Expected:
array([[0, 1, 2]])
Got:
array([[0, 1, 2]], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:1579: DocTestFailure
____________________________________________________________ [doctest] sparse._coo.core.COO.linear_loc ____________________________________________________________
1244
1245 See Also
1246 --------
1247 :obj:`numpy.flatnonzero` : Equivalent Numpy function.
1248
1249 Examples
1250 --------
1251 >>> x = np.eye(5)
1252 >>> s = COO.from_numpy(x)
1253 >>> s.linear_loc() # doctest: +NORMALIZE_WHITESPACE
Expected:
array([ 0, 6, 12, 18, 24])
Got:
array([ 0, 6, 12, 18, 24], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:1253: DocTestFailure
______________________________________________________________ [doctest] sparse._coo.core.COO.nbytes ______________________________________________________________
614 See Also
615 --------
616 numpy.ndarray.nbytes : The equivalent Numpy property.
617
618 Examples
619 --------
620 >>> data = np.arange(6, dtype=np.uint8)
621 >>> coords = np.random.randint(1000, size=(3, 6), dtype=np.uint16)
622 >>> s = COO(coords, data, shape=(1000, 1000, 1000))
623 >>> s.nbytes
Expected:
150
Got:
78
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:623: DocTestFailure
_____________________________________________________________ [doctest] sparse._coo.core.COO.nonzero ______________________________________________________________
1763
1764 Raises
1765 ------
1766 ValueError
1767 If the array doesn't have zero fill-values.
1768
1769 Examples
1770 --------
1771 >>> s = COO.from_numpy(np.eye(5))
1772 >>> s.nonzero()
Expected:
(array([0, 1, 2, 3, 4]), array([0, 1, 2, 3, 4]))
Got:
(array([0, 1, 2, 3, 4], dtype=int32), array([0, 1, 2, 3, 4], dtype=int32))
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/core.py:1772: DocTestFailure
__________________________________________________________ [doctest] sparse._coo.indexing._filter_pairs ___________________________________________________________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> _filter_pairs(starts, stops, coords, indices)
Expected:
ListType[int64]([2, 4, 6])
Got:
ListType[int32]([2, 4, 6])
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/indexing.py:None: DocTestFailure
_________________________________________________________ [doctest] sparse._coo.indexing._get_mask_pairs __________________________________________________________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> _get_mask_pairs(starts_old, stops_old, c, idx)
Expected:
(ListType[int64]([4]), ListType[int64]([6]), 2)
Got:
(ListType[int32]([4]), ListType[int32]([6]), 2)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/indexing.py:None: DocTestFailure
_______________________________________________________ [doctest] sparse._coo.indexing._ind_ar_from_indices _______________________________________________________
197 Input indices (slices and integers)
198
199 Returns
200 -------
201 ind_ar : np.ndarray
202 The output array.
203
204 Examples
205 --------
206 >>> _ind_ar_from_indices([1])
Expected:
array([[1, 2, 1]])
Got:
array([[1, 2, 1]], dtype=int32)
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/indexing.py:206: DocTestFailure
_______________________________________________________ [doctest] sparse._coo.indexing._join_adjacent_pairs _______________________________________________________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> _join_adjacent_pairs(starts, stops)
Expected:
(ListType[int64]([2]), ListType[int64]([7]))
Got:
(ListType[int32]([2]), ListType[int32]([7]))
/home/diane/python-sparse-0.11.2/.pybuild/cpython3_3.9_sparse/build/sparse/_coo/indexing.py:None: DocTestFailure
I can disable doctests for 32-bit systems.
But those are innocent errors.
After looking at it a bit I thought they were innocent too, but I wanted to double check.
Our build process won't trigger those problems, so I don't think you need to disable the doctests unless you think someone else is going to show up trying to build sparse on 32-bit systems.
Hi,
We have these doctests errors in Apertis (okay it's derived from Debian). It would be nice if doctests could be disabled for 32-bit systems.
Best,