/// <summary> /// Create `CompareOps` /// </summary> /// <param name="ops1">first `IOps` implementation</param> /// <param name="ops2">second `IOps` implementation</param> /// <param name="differenceLogLevel">difference log level</param> /// <param name="epsilon">error threshold</param> public CompareOps(IOps ops1, IOps ops2, CompareOpsUtils.LogLevel differenceLogLevel, float epsilon) { m_Ops1 = ops1; m_Ops2 = ops2; m_DifferenceLogLevel = differenceLogLevel; m_Epsilon = epsilon; }
public WorkerConfiguration(Type compareAgainstType, bool verbose = false, CompareOpsUtils.LogLevel compareLogLevel = CompareOpsUtils.LogLevel.Warning, float compareEpsilon = 0.0001f) { this.verbose = verbose; this.compareAgainstType = compareAgainstType; this.compareLogLevel = compareLogLevel; this.compareEpsilon = compareEpsilon; }
/// <summary> /// Create a worker with explicitly specified backend `type` to execute the given `model`. /// `type` is backend type to use. For example `WorkerFactory.Type.Compute` specifies the fast GPU path. /// `model` is the associated model. See ModelLoader.cs. /// `verbose` will log scheduling of layers execution to the console. /// `compareAgainstType` if different than `type` model will be run on those two backend and result of every layer will be compared, checking for divergence. Great for debugging, but very slow because of the sync needed. /// `differenceAsError` if `compareAgainstType` is used difference will be reported as error is this is true or warning otherwise. /// </summary> public static IWorker CreateWorker(Type type, Model model, bool verbose, Type compareAgainstType, CompareOpsUtils.LogLevel differenceLogLevel = CompareOpsUtils.LogLevel.Warning) { var workerConfiguration = new WorkerConfiguration(type, verbose); workerConfiguration.compareAgainstType = compareAgainstType; workerConfiguration.compareLogLevel = differenceLogLevel; return(CreateWorker(type, model, additionalOutputs: null, trimOutputs: null, workerConfiguration)); }
/// <summary> /// Create a worker with explicitly specified backend `type` to execute the given `model`. /// `type` is backend type to use. For example `WorkerFactory.Type.Compute` specifies the fast GPU path. /// `model` is the associated model. See ModelLoader.cs. /// `additionalOutputs` are the additional outputs to track but not directly specified by the model. /// `trimOutputs` are the outputs not discard even if they are specified by the model. /// `verbose` will log scheduling of layers execution to the console. /// `compareAgainstType` if different than `type` model will be run on those two backend and result of every layer will be compared, checking for divergence. Great for debugging, but very slow because of the sync needed. /// `differenceAsError` if `compareAgainstType` is used difference will be reported as error is this is true or warning otherwise. /// </summary> public static IWorker CreateWorker(Type type, Model model, string[] additionalOutputs, string[] trimOutputs, bool verbose, Type compareAgainstType, CompareOpsUtils.LogLevel differenceLogLevel = CompareOpsUtils.LogLevel.Warning) { var workerConfiguration = new WorkerConfiguration(type, verbose); workerConfiguration.compareAgainstType = compareAgainstType; workerConfiguration.compareLogLevel = differenceLogLevel; return(BarracudaBackendsFactory.CreateWorker(type, model, additionalOutputs, trimOutputs, workerConfiguration)); }