issue 2954: c# API memory leak
This commit is contained in:
Родитель
3a229624be
Коммит
3e83c56b8f
|
@ -22,7 +22,7 @@ namespace CNTK
|
|||
public static Trainer CreateTrainer(Function model, Function lossFunction, Function evaluationFunction, IList<Learner> parameterLearners,
|
||||
ProgressWriterVector progressWriters = null)
|
||||
{
|
||||
LearnerVector learnerVector = Helper.AsLearnerVector(parameterLearners);
|
||||
using (LearnerVector learnerVector = Helper.AsLearnerVector(parameterLearners))
|
||||
if (progressWriters != null)
|
||||
return CNTKLib.CreateTrainer(model, lossFunction, evaluationFunction, learnerVector, progressWriters);
|
||||
else
|
||||
|
@ -37,7 +37,7 @@ namespace CNTK
|
|||
/// <returns></returns>
|
||||
public bool TrainMinibatch(IDictionary<Variable, MinibatchData> arguments, DeviceDescriptor computeDevice)
|
||||
{
|
||||
UnorderedMapVariableMinibatchData vectorData = Helper.AsUnorderedMapVariableMinibatchData(arguments);
|
||||
using (UnorderedMapVariableMinibatchData vectorData = Helper.AsUnorderedMapVariableMinibatchData(arguments))
|
||||
return _TrainMinibatch(vectorData, computeDevice);
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,8 @@ namespace CNTK
|
|||
[System.Obsolete("TrainMinibatch() without isSweepEndInarguments will be deprecated soon. Please TrainMinibatch() with isSweepEndInarguments.", false)]
|
||||
public bool TrainMinibatch(IDictionary<Variable, Value> arguments, DeviceDescriptor computeDevice)
|
||||
{
|
||||
UnorderedMapVariableValuePtr mapData = Helper.AsUnorderedMapVariableValue(arguments);
|
||||
bool isSweepEndInarguments = false;
|
||||
using (UnorderedMapVariableValuePtr mapData = Helper.AsUnorderedMapVariableValue(arguments))
|
||||
return _TrainMinibatch(mapData, isSweepEndInarguments, computeDevice);
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace CNTK
|
|||
/// <returns></returns>
|
||||
public bool TrainMinibatch(IDictionary<Variable, Value> arguments, bool isSweepEndInarguments, DeviceDescriptor computeDevice)
|
||||
{
|
||||
UnorderedMapVariableValuePtr mapData = Helper.AsUnorderedMapVariableValue(arguments);
|
||||
using (UnorderedMapVariableValuePtr mapData = Helper.AsUnorderedMapVariableValue(arguments))
|
||||
return _TrainMinibatch(mapData, isSweepEndInarguments, computeDevice);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче