Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

[2.0] obscure error message when trying to print mx.np.array (dtype=int32) created in hybridized block #20417

@fhieber

Description

@fhieber

Description

An error is thrown when trying to print an mx.np.array of type int32. Unfortunately the error is difficult to reproduce.

Error Message

File "/Users/fhieber/workspace/sockeye/sockeye/beam_search.py", line 886, in forward
    print('2', finished)
  File "/Users/fhieber/workspace/mxnet/python/mxnet/numpy/multiarray.py", line 1379, in __str__
    array_str = self.asnumpy().__str__()
  File "/Users/fhieber/workspace/mxnet/python/mxnet/ndarray/ndarray.py", line 2626, in asnumpy
    ctypes.c_size_t(data.size)))
  File "/Users/fhieber/workspace/mxnet/python/mxnet/base.py", line 246, in check_call
    raise get_last_ffi_error()
mxnet.base.MXNetError: Traceback (most recent call last):
  File "/Users/fhieber/workspace/mxnet/src/operator/tensor/indexing_op.cc", line 313
MXNetError: Check failed: is_valid: take operator contains indices out of bound

To Reproduce

Unfortunately I am not able to reproduce this with a minimal example. The array from the error message above is produced in a hybridized block before like this and returned as an output of that block:

finished = np.logical_or(best_word_indices == self.pad_id, best_word_indices == self.eos_id)
finished = npx.cast(np.expand_dims(finished, axis=1), 'int32')

The print statement in the stack trace above was added in the block code that executes the hybrid block.

Steps to reproduce

Environment:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions