Skip to content

Commit

Permalink
fix jni typo
Browse files Browse the repository at this point in the history
  • Loading branch information
黄子轩 committed Jan 15, 2016
1 parent 1b98427 commit f9b8e3e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 23 deletions.
44 changes: 22 additions & 22 deletions scala-package/core/src/test/scala/ml/dmlc/mxnet/IOSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,29 @@ class IOSuite extends FunSuite with BeforeAndAfterAll {


/**
* not work now
* for time
*/
// test("test ImageRecordIter") {
// //get data
// //"./scripts/get_cifar_data.sh" !
//
// val params = Map(
// "path_imgrec" -> "data/cifar/train.rec",
// "mean_img" -> "data/cifar/cifar10_mean.bin",
// "rand_crop" -> "False",
// "and_mirror" -> "False",
// "shuffle" -> "False",
// "data_shape" -> "(3,28,28)",
// "batch_size" -> "100",
// "preprocess_threads" -> "4",
// "prefetch_buffer" -> "1"
// )
// val img_iter = IO.createIterator("ImageRecordIter", params)
// img_iter.reset()
// while(img_iter.iterNext()) {
// val batch = img_iter.next()
// }
// }
test("test ImageRecordIter") {
//get data
"./scripts/get_cifar_data.sh" !

val params = Map(
"path_imgrec" -> "data/cifar/train.rec",
"mean_img" -> "data/cifar/cifar10_mean.bin",
"rand_crop" -> "False",
"and_mirror" -> "False",
"shuffle" -> "False",
"data_shape" -> "(3,28,28)",
"batch_size" -> "100",
"preprocess_threads" -> "4",
"prefetch_buffer" -> "1"
)
val img_iter = IO.createIterator("ImageRecordIter", params)
img_iter.reset()
while(img_iter.iterNext()) {
val batch = img_iter.next()
}
}

// test("test NDarryIter") {
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,13 @@ JNIEXPORT jint JNICALL Java_ml_dmlc_mxnet_LibInfo_mxDataIterGetIndex
jmethodID listAppend = env->GetMethodID(listClass,
"$plus$eq", "(Ljava/lang/Object;)Lscala/collection/mutable/ListBuffer;");

//long class
jclass longCls = env->FindClass("java/lang/Long");
jmethodID longConst = env->GetMethodID(longCls, "<init>", "(J)V");

for(int i=0; i<coutSize; i++) {
env->CallObjectMethod(outIndex, listAppend, (jlong)coutIndex[i]);
env->CallObjectMethod(outIndex, listAppend,
env->NewObject(longCls, longConst, coutIndex[i]));
}
return ret;
}
Expand Down

0 comments on commit f9b8e3e

Please sign in to comment.