Last active
October 24, 2015 22:52
-
-
Save piiswrong/62fb35b9da8a9ce7ff17 to your computer and use it in GitHub Desktop.
Engine Crashes if asnumpy() is not called on result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import mxnet as mx | |
from common import models | |
import pickle as pkl | |
def test_softmax_with_shape(shape, xpu): | |
X = mx.symbol.Variable('X') | |
L = mx.symbol.Variable('L') | |
Y = mx.symbol.Softmax(data=X, label=L) | |
x = mx.random.uniform(-1, 1, shape, ctx = xpu) | |
l = mx.nd.empty((shape[0],), ctx = xpu) | |
l[:] = np.random.randint(0, shape[0]-1, (shape[0],)) | |
grad = mx.nd.empty(shape, ctx = xpu) | |
exec1 = Y.bind(xpu, args = [x, l], args_grad = {'X': grad}) | |
print 'foward' | |
exec1.forward() | |
#print exec1.outputs[0].asnumpy() include this line and it works fine | |
test_softmax_with_shape((3,4), mx.cpu()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Crash happens randomly. Somewhere around 50%