示例#1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="env">environment like ConsoleEnvironment</param>
 /// <param name="transform">transform to convert</param>
 /// <param name="sourceToReplace">source to replace</param>
 /// <param name="conc">number of concurrency threads</param>
 public ValueMapperFromTransform(IHostEnvironment env, IDataTransform transform,
                                 IDataView sourceToReplace = null, int conc = 1)
 {
     Contracts.AssertValue(env);
     Contracts.AssertValue(transform);
     _env                = env;
     _transform          = transform;
     _sourceToReplace    = sourceToReplace;
     _disposeEnv         = conc > 0;
     _computeEnv         = _disposeEnv ? new PassThroughEnvironment(env, conc: conc, verbose: false) : env;
     _valueMapperDispose = GetMapperDispose();
 }
示例#2
0
 public void Dispose()
 {
     if (_disposeEnv)
     {
         (_computeEnv as PassThroughEnvironment).Dispose();
         _computeEnv = null;
     }
     if (_valueMapperDispose != null)
     {
         _valueMapperDispose.Dispose();
         _valueMapperDispose = null;
     }
 }