szha commented on issue #18938:
URL: 
https://github.com/apache/incubator-mxnet/issues/18938#issuecomment-678068013


   So here's the problem:
   ```
   % DMLC_LOG_STACK_TRACE_DEPTH=150 MXNET_ENGINE_TYPE=NaiveEngine lldb 
python3.7 -- test_18938.py
   (lldb) target create "python3.7"
   Current executable set to 'python3.7' (x86_64).
   (lldb) settings set -- target.run-args  "test_18938.py"
   (lldb) run
   Process 45668 launched: '/usr/local/bin/python3.7' (x86_64)
   Process 45668 stopped
   * thread #2, stop reason = exec
       frame #0: 0x0000000100006000 dyld`_dyld_start
   dyld`_dyld_start:
   ->  0x100006000 <+0>: popq   %rdi
       0x100006001 <+1>: pushq  $0x0
       0x100006003 <+3>: movq   %rsp, %rbp
       0x100006006 <+6>: andq   $-0x10, %rsp
   (lldb) cont
   Process 45668 resuming
   [23:29:59] ../src/engine/engine.cc:55: MXNet start using engine: NaiveEngine
   Process 45668 stopped
   * thread #2, queue = 'com.apple.main-thread', stop reason = EXC_ARITHMETIC 
(code=EXC_I386_DIV, subcode=0x0)
       frame #0: 0x0000000115e85453 
libmxnet.dylib`mxnet::op::SequenceLastOp<mshadow::cpu, float, 
int>::Forward(this=0x000000010066a490, ctx=0x00007ffeefbfc2b0, 
in_data=0x00000001006dcf08, req=0x00007ffeefbfc310, 
out_data=0x00000001006dcf50, aux_args=0x00000001006dcf38) at 
sequence_last-inl.h:158
      155
      156           auto batch = (axis != 0) ? d0 : d1;
      157           auto max_seq_len = in_data[seq_last::kData].size(axis);
   -> 158           auto rest_size = dsize / (d0 * d1);
      159
      160           Tensor<xpu, 3, DType> data =
      161               in_data[seq_last::kData].get_with_shape<xpu, 3, DType>(
   ```
   
   
https://github.com/apache/incubator-mxnet/blob/9bdd4d6347c284770ee5bfe5ae98f1dabc283829/src/operator/sequence_last-inl.h#L158
   
   The code needs to guard against zero-size array for right operand of `/`, 
and we should add a smoke test to guard against such problem in this op, 
similar to https://github.com/apache/incubator-mxnet/pull/18972/files


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to