MLModel prediction gets blocked

Is there any limitation for using MLModel in multiple NSOperations?

I'm trying to get predictions from a MLModel, but sometimes the prediction function gets blocked.

I'm running 15 NSOperations concurrently in a queue with qualityOfService = .userInitiated.

Each operation is calling 45 times the prediction method:


  ....
  for groupedData in subArrayOfRawData {

  let mlm = try MLMultiArray(shape:[NSNumber(value:SIZE_MULTIARRAY)], dataType:.double)

  for (index, element) in groupedData.enumerated() {
  mlm[index] = NSNumber(value: element)
  }

  let x = try myModel().prediction(input1: mlm)

  results.append(x.output1)
  }
  ....


I'm running a lot of tasks in the CPU just before calling to the prediction. Is there any limitation if there is not enough resources, so it gets block?

Thanks

Replies

It would be very helpful if you file a bug report showing us how to reproduce the problem. Please reply to my post with the bug number. Thanks.