Post

Replies

Boosts

Views

Activity

Comment on How to dispatch my `MLCustomLayer` to GPU instead of CPU
Hi, thank you for your response. Yes, my current implementation already compiles the model on the device as follows; NSString* modelPath = [NSString stringWithUTF8String:model_path.c_str()]; NSURL* modelURL = [NSURL fileURLWithPath:modelPath]; NSURL* compiledModel = [MLModel compileModelAtURL:modelURL error:error]; MLModel* module = [MLModel modelWithContentsOfURL:compiledModel error:NULL]; where model_path is a std::string set to the correct model path on the device (and checked to see if it exists). (My apologies for the badly formatted code snippet; the forums don't seem to allow for non-inline code in comments.)
Dec ’21