mpsgraphtool doesn't work

Hi there, I'm trying to convert my CoreML model (it's actually .mlpackage) to .mpsgraphpackage so I can test the performance of my model with MPSGraph API. I run the code you provide in terminal but it just does nothing (command execute forever). In Activity Monitor terminal uses 0.0% of CPU. I My XCode version 15.0 beta 6 (15A5219j) and running in OS Sonoma 14.0 Beta (23A5312d)

  • I have the same issue using macOS Sonoma 14.1 and XCode 15.0.1 (15A507). It just hangs forever. In CoreML, the model works fine.

Add a Comment

Replies

Merhaba Size Yazacağım Kodu Kullanız Lütfen

import MPSGraph

// Metal cihazını oluştur
guard let device = MTLCreateSystemDefaultDevice() else {
    
    fatalError

   
fatalError("Metal desteklenmiyor.")
}

// MPSGraph bağlamını oluştur
let graph = MPSGraph(device: device)

// Giriş matrisini tanımla
let inputShape = MPSGraphTensorShape(batchSize: 1, width: 3, height: 3, featureChannels: 1)
let inputTensor = graph.placeHolderTensor(shape: inputShape)

// Matris transpozunu almak için düğüm oluştur
let transposeNode = graph.transpose(withPrimaryTensor: inputTensor, permutation: [0, 2, 1, 3])

// Çıkış düğümünden sonucu al
guard let resultTensor = transposeNode.result else {
    
   
fatalError("Sonuç elde edilemedi.")
}

// Hesaplamaları başlat
let options = MPSGraphExecutionOptions()
options.executionTarget = .metal
try graph.executeAsync(with: resultTensor, device: device, options: options) { (result, error) in
    
   
if let error = error {
        
        print

       
print("Hata: \(error)")
    } 
    }

   
else {
        
       
let resultData = result.data
        
        print
print("Transpoze Sonuç Verileri: \(resultData)")
    }
}

    }
}
``

    }
BuMPSGraph kullanMPSGraph düğümlerMPSGraph kullanım

Saygılarımla Apple Türkiye Siber Güvenlik Uzmanı Fırat Averbek