diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift index 8947e275597d68237e00cc188586d60dd6866119..be18c4411ffbef704dff61bb2aa82bc338daf163 100644 --- a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift +++ b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift @@ -34,9 +34,15 @@ class PriorBoxKernel: Kernel, Computable{ required init(device: MTLDevice, param: PriorBoxParam

) { - param.output.initTexture(device: device, inTranspose: [2, 0, 1, 3], computePrecision: computePrecision) + let originDim = param.output.tensorDim; + + param.output.tensorDim = Dim.init(inDim: [1, originDim[0], originDim[1], originDim[2] * originDim[3]]) + param.output.padToFourDim = Dim.init(inDim: [1, originDim[0], originDim[1], originDim[2] * originDim[3]]) + + param.output.initTexture(device: device, inTranspose: [0, 1, 2, 3], computePrecision: computePrecision) param.outputVariances.initTexture(device: device, inTranspose: [2, 0, 1, 3], computePrecision: computePrecision) + if computePrecision == .Float32 { if param.min_max_aspect_ratios_order { super.init(device: device, inFunctionName: "prior_box_MinMaxAspectRatiosOrder") @@ -59,13 +65,13 @@ class PriorBoxKernel: Kernel, Computable{ fatalError(" need implement ") } - let n = 1 - let h = param.output.dim[1] - let w = param.output.dim[2] - let c = param.output.dim[3] * param.output.dim[0] - - param.output.dim = Dim.init(inDim: [n, h, w, c]) - param.output.transpose = [0, 1, 2, 3] +// let n = 1 +// let h = param.output.dim[1] +// let w = param.output.dim[2] +// let c = param.output.dim[3] * param.output.dim[0] +// +// param.output.dim = Dim.init(inDim: [n, h, w, c]) +// param.output.transpose = [0, 1, 2, 3] let imageWidth = Float32(param.inputImage.padToFourDim[3]) let imageHeight = Float32(param.inputImage.padToFourDim[2])