/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ import Foundation import Metal class ConvAddAddPreluParam: OpParam { //typealias ParamPrecisionType = P required init(opDesc: PMOpDesc, inScope: Scope) throws { do { filter = try ConvAddAddPreluParam.inputFilter(paraInputs: opDesc.paraInputs, from: inScope) input = try ConvAddAddPreluParam.input(inputs: opDesc.inputs, from: inScope) output = try ConvAddAddPreluParam.outputOut(outputs: opDesc.outputs, from: inScope) stride = try ConvAddAddPreluParam.getAttr(key: "strides", attrs: opDesc.attrs) paddings = try ConvAddAddPreluParam.getAttr(key: "paddings", attrs: opDesc.attrs) dilations = try ConvAddAddPreluParam.getAttr(key: "dilations", attrs: opDesc.attrs) groups = try ConvAddAddPreluParam.getAttr(key: "groups", attrs: opDesc.attrs) alpha = try ConvAddAddPreluParam.paramInputAlpha(inputs: opDesc.paraInputs, from: inScope) mode = try ConvAddAddPreluParam.getAttr(key: "mode", attrs: opDesc.attrs) y = try ConvAddAddPreluParam.inputY(inputs: opDesc.paraInputs, from: inScope) } catch let error { throw error } } let input: Texture let y: Tensor

let filter: Tensor

let mode: String let alpha: Tensor

var output: Texture let stride: [Int32] let paddings: [Int32] let dilations: [Int32] let groups: Int } class ConvAddAddPreluOp: Operator, ConvAddAddPreluParam

>, Runable, Creator, InferShaperable, Fusion{ typealias OpType = ConvAddAddPreluOp

static func fusionNode() -> Node { let beginNode = Node.init(inType: gConvType) _ = beginNode --> Node.init(inType: gElementwiseAddType) --> Node.init(inType: gElementwiseAddType) --> Node.init(inType: gPreluType) return beginNode } static func change() -> [String : [(from: String, to: String)]] { return [:] } static func fusionType() -> String { return gConvAddAddPreluType } static func needCheck() -> [(Int, String)] { return [(2, "Y"), (2, "X")] } func inferShape() { let inDims = para.input.dim let filterDim = para.filter.dim let strides = para.stride let paddings = para.paddings let dilations = para.dilations var outDim = [inDims[0]] for i in 0..