// // /*=============================================================================== // // Copyright (C) 2020 PhantomsXR Ltd. All Rights Reserved. // // // // This file is part of the AR-MOD SDK. // // // // The AR-MOD SDK cannot be copied, distributed, or made available to // // third-parties for commercial purposes without written permission of PhantomsXR Ltd. // // // // Contact info@phantomsxr.com for licensing requests. // // ===============================================================================*/ using com.PhantomsXR.BarracudaExtension.Runtime; using Unity.Barracuda; using Unity.VisualScripting; namespace com.PhantomsXR.VisualScriptingExtension.Runtime { [UnitCategory("ARMOD/NNEInference"), UnitTitle("Create Worker"), UnitShortTitle("Create Worker")] public class CreateNNEWorkerUnit : ARMODBaseWithResultUnit { [DoNotSerialize] public ValueInput WorkerType; [DoNotSerialize] public ValueInput Model; private IWorker worker; protected override void Definition() { base.Definition(); WorkerType = ValueInput("", WorkerFactory.Type.CSharpBurst); Model = ValueInput(nameof(Model), (Model) null); Result = ValueOutput(nameof(worker), _flow => worker); Requirement(WorkerType, inputTrigger); } public override ControlOutput Execute(Flow _arg) { var tmp_Model = _arg.GetValue(Model); var tmp_Type = _arg.GetValue(WorkerType); worker = NNEInference.CreateBarracudaWorker(tmp_Type, tmp_Model); return outputTrigger; } } }