From efb41cc3a0e28f91bcf525ba34ab535533556d28 Mon Sep 17 00:00:00 2001 From: liuruilong Date: Mon, 17 Sep 2018 10:44:17 +0800 Subject: [PATCH] change prior box output dim --- .../Operators/Kernels/PriorBoxKernel.swift | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift b/metal/paddle-mobile/paddle-mobile/Operators/Kernels/PriorBoxKernel.swift index 8947e27559..be18c4411f 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]) -- GitLab