1

I'm integrating WindowsML neural network inference into a project targeting Windows 10 (Windows SDK version 17134).

Loading model from file works fine, as well as other inference steps.

But loading model from stream consistently throws hresult_not_implemented exception (using C++/WinRT) or "The method or operation is not implemented." exception (using C#).

C# code:

using Windows.AI.MachineLearning.Preview;
// ...

// LoadModelFromStorageFileAsync works fine
var learningModel = await LearningModelPreview.LoadModelFromStorageFileAsync(file);

// .....

// LoadModelFromStreamAsync throws "not implemented" exception:
var stream = Windows.Storage.Streams.RandomAccessStreamReference.CreateFromFile(file);
var learningModel = await LearningModelPreview.LoadModelFromStreamAsync(stream);

Is that a known issue for 17134 version of Windows SDK, or this method supposed to work? Did not find any limitation info in the docs linked.

Any help or information will be very appreciated. Thanks!

P.S. I'm aware that Windows.AI.MachineLearning.Preview namespace is deprecated since Windows SDK 17763, but my current limitation is 17134 version, so I'm forced to use Preview.

k.v.
  • 1,193
  • 8
  • 11
  • Also reported [here](https://mtaulty.com/2018/03/29/third-experiment-with-image-classification-on-windows-ml-from-uwp-on-hololens-in-unity/). It is quite likely this method is indeed not implemented. But can't be sure since we can't check its source code. – kennyzx Oct 25 '18 at 09:53
  • @kennyzx Thank you for the link! I've checked this on 2 different machines, and this information at least gives one more observation :) – k.v. Oct 25 '18 at 10:13

1 Answers1

3

Yes. In that version of the API it did not implement loading from a stream.

In your scenario can you get your stream converted to a IStorageFile ?

Paul McDaniel
  • 1,471
  • 1
  • 7
  • 6
  • Thank you for the answer! If by conversion you mean temporary save data to a file and read it - then this is not a good option for me. But if there is a way to do such conversion in memory - I'll be grateful for a hint. – k.v. Dec 04 '18 at 12:18