You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/10/19 22:54:41 UTC
[GitHub] andrewfayres commented on a change in pull request #12882: use
ResourceScope in Model/Trainer/FeedForward.scala
andrewfayres commented on a change in pull request #12882: use ResourceScope in Model/Trainer/FeedForward.scala
URL: https://github.com/apache/incubator-mxnet/pull/12882#discussion_r226800508
##########
File path: scala-package/core/src/main/scala/org/apache/mxnet/FeedForward.scala
##########
@@ -277,13 +277,15 @@ class FeedForward private(
def fit(trainData: DataIter, evalData: DataIter, evalMetric: EvalMetric, kvStoreType: String,
epochEndCallback: EpochEndCallback, batchEndCallback: BatchEndCallback,
logger: Logger, workLoadList: Seq[Float]): Unit = {
- // init params first to allow kv store use _argParams to decide its type
- initSymbolParams(trainData)
- // create kvstore
- val (kvStore, updateOnKVStore) = Model.createKVStore(kvStoreType, ctx.length, _argParams)
- fit(trainData, evalData, evalMetric, kvStore, updateOnKVStore,
- epochEndCallback, batchEndCallback, logger, workLoadList)
- kvStore.foreach(_.dispose())
+ ResourceScope.using() {
+ // init params first to allow kv store use _argParams to decide its type
+ initSymbolParams(trainData)
+ // create kvstore
+ val (kvStore, updateOnKVStore) = Model.createKVStore(kvStoreType, ctx.length, _argParams)
+ fit(trainData, evalData, evalMetric, kvStore, updateOnKVStore,
+ epochEndCallback, batchEndCallback, logger, workLoadList)
+// kvStore.foreach(_.dispose())
Review comment:
There a reason to keep this?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services