17 for (
unsigned int i = 0; i < (numDimensions-1); ++i)
25 unsigned int w = in.
GetShape()[numDimensions-1];
35 template<
typename SlotListType>
38 std::vector<SlotListType>& inputLayersSlotLists,
39 std::vector<SlotListType>& outputLayersSlotLists)
42 inputLayersSlotLists.push_back({0, 1});
43 inputLayersSlotLists.push_back({1});
44 inputLayersSlotLists.push_back({1});
47 inputLayersSlotLists.push_back({});
53 outputLayersSlotLists.push_back({0});
57 outputLayersSlotLists.push_back({});
59 outputLayersSlotLists.push_back({});
62 outputLayersSlotLists.push_back({});
63 outputLayersSlotLists.push_back({0});
67 outputLayersSlotLists.push_back({0});
75 for (
unsigned int layerIdx = 0; layerIdx< 4; ++layerIdx)
77 if (! layerList[layerIdx])
82 fusedName += layerList[layerIdx]->
GetNameStr();
86 template<
typename Type>
88 unsigned int& numInputs,
89 unsigned int& numOutputs,
90 std::vector<TensorInfo>& inputInfos,
91 std::vector<TensorInfo>& outputInfos,
112 return (expanded.GetNumDimensions() == 1);
118 auto& mulLayer = *(PolymorphicDowncast<ElementwiseBinaryLayer*>(layerList[1]));
119 auto& add2Layer = *(PolymorphicDowncast<ElementwiseBinaryLayer*>(layerList[2]));
134 fuseReLu = (layerList[3] !=
nullptr);
137 activationDescriptor = &PolymorphicDowncast<ActivationLayer *>(layerList[3])->GetParameters();
147 unsigned int layerIdx = 0;
148 unsigned int inputSlotCount = 0;
149 for (layerIdx = 0; layerIdx < 3; ++layerIdx)
151 for (
unsigned int slotIdx = 0; slotIdx < layerList[layerIdx]->GetNumInputSlots(); ++slotIdx)
153 InputSlot* inputSlot = &layerList[layerIdx]->GetInputSlot(slotIdx);
169 if (numInputs == 2 || numInputs == 3)
176 if (previousLayerSlot)
186 = std::make_unique<ScopedTensorHandle>(
193 inputInfos.push_back(inputSlotInfo);
203 bool validInputCount = (inputSlotCount == 6) && (inputInfos.size() == 4);
204 if (! validInputCount)
209 const unsigned int maxIdx = (fuseReLu) ? 4 : 3;
210 for (layerIdx = 0; layerIdx < maxIdx; ++layerIdx)
212 for (
unsigned int slotIdx = 0; slotIdx < layerList[layerIdx]->GetNumOutputSlots(); ++slotIdx)
214 OutputSlot* outputSlot = &layerList[layerIdx]->GetOutputSlot(slotIdx);
216 for (
unsigned int connectionIdx = 0; connectionIdx < outputSlot->
GetNumConnections(); ++connectionIdx)
219 if (layerIdx < (maxIdx-1))
227 else if (layerList[layerIdx] !=
nullptr)
237 bool validOutputCount = (outputInfos.size() > 0);
238 if (! validOutputCount)