19 void UpdateOutputSlotToFp32(OutputSlot& outputSlot)
21 const TensorInfo& origTensorInfo = outputSlot.GetTensorInfo();
22 TensorInfo newTensorInfo(origTensorInfo);
24 outputSlot.SetTensorInfo(newTensorInfo);
27 void ChangeOutputFp16ToFp32(Layer& layer)
29 for (
auto&& outputSlot = layer.BeginOutputSlots(); outputSlot != layer.EndOutputSlots(); ++outputSlot)
33 UpdateOutputSlotToFp32(*outputSlot);
42 bool expectCorrectInputType)
44 std::vector<ConvertFp16ToFp32Layer*> convertLayers;
50 bool allowInsert =
true;
51 if (expectCorrectInputType)
54 OutputSlot* connectedOutputSlot = inputSlot->GetConnectedOutputSlot();
61 const std::string name =
62 std::string(
"convert_fp16_to_fp32-" + std::to_string(inputSlot->GetSlotIndex()) +
"-") +
72 convertLayers.emplace_back(convertLayer);
83 std::vector<ConvertFp32ToFp16Layer*> convertLayers;
84 convertLayers.reserve(numOutputSlots);
87 ChangeOutputFp16ToFp32(layer);
90 for (
unsigned int slotIndex = 0u; slotIndex < numOutputSlots; ++slotIndex)
95 const std::string name =
96 std::string(
"convert_fp32_to_fp16-" + std::to_string(slotIndex) +
"-") + layer.
GetName();
105 convertLayers.emplace_back(convertLayer);
109 return convertLayers;
114 std::vector<DebugLayer*> debugLayers;
118 uint32_t outputSlotIdx = 0;
121 const std::string debugName = std::string(
"DebugLayerAfter") + layer.
GetNameStr() +
"_" +
122 std::to_string(outputSlotIdx);
136 debugLayers.emplace_back(debugLayer);