-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Java examples broken with mxnet mkldnn build #15267
Comments
Hey, this is the MXNet Label Bot. |
@mxnet-label-bot add [Java, Scala, MKLDNN] |
I've separated the bug from java interface, it comes from the slice operation in java predict:
I reproduced the bug with python code:
I tested the above script on multiple mxnet versions: it works fine in 1.4, but triggers the error on 1.5.
|
@TaoLv could you help to take a look for slice? |
Sure. I will work on this later. |
@arcadiaphy @pengzhao-intel This issue is root caused. The flatten layer before slice is not properly handled. It can be reproduced as below. We already have a fix in local and will submit a PR soon. Do you think we should have the fix into 1.5.0 release? import mxnet as mx
import numpy as np
from mxnet import Context
np.random.seed(12345)
data = mx.symbol.Variable('data')
weight = mx.symbol.Variable('weight')
bias = mx.symbol.Variable('bias')
conv1= mx.symbol.Convolution(data = data, weight=weight, bias=bias, name='conv1', num_filter=64, kernel=(3,3), stride=(1,1))
flatten1 = mx.symbol.flatten(data = conv1)
slice1 = mx.symbol.slice(data = flatten1, begin=0, end=1)
shape = (2, 16, 224, 224)
val = np.random.rand(2, 16, 224, 224).astype(np.float32)
exe = slice1.simple_bind(Context.default_ctx, data=shape)
exe.arg_arrays[0][:] = val
exe.arg_arrays[1][:] = np.random.normal(size=exe.arg_arrays[1].shape)
p = exe.forward(is_train=False)
p[0].wait_to_read()
print(p[0]) |
Fixed and closing now. Thanks to reporting the issue :) |
Description
I've built the scala-package with mxnet mkldnn and run the java demo ImageClassification, but the demo is broken on mobillenet.
Environment info (Required)
Build info (Required if built from source)
mac build with clang
latest commit:
cab1dfa
Error Message:
Minimum reproducible example
https://github.com/apache/incubator-mxnet/blob/master/scala-package/mxnet-demo/java-demo/src/main/java/mxnet/ImageClassification.java
I've replaced the resnet-18 in the script with mobilenet:
model.zip
The text was updated successfully, but these errors were encountered: