in SemanticSegmentationSample/Common/SemanticMapToImage.swift [85:92]
func sourceTexture(_ semanticMap: MLShapedArray<Int32>) -> MTLTexture? {
let (width, height) = (semanticMap.shape[0], semanticMap.shape[1])
let texture = makeTexture(width: width, height: height)
let region = MTLRegionMake2D(0, 0, width, height)
let array = MLMultiArray(semanticMap)
texture?.replace(region: region, mipmapLevel: 0, withBytes: array.dataPointer, bytesPerRow: width * MemoryLayout<Int32>.stride)
return texture
}