made style_weights NN argument optional

This commit is contained in:
singinwhale 2022-11-08 10:20:37 +01:00
parent 3bfe5ec9d1
commit f16119ca84
1 changed files with 7 additions and 4 deletions

View File

@ -67,7 +67,6 @@ FStyleTransferSceneViewExtension::FStyleTransferSceneViewExtension(const FAutoRe
else if (TensorName == "style_params") StyleParamsInputTensorIndex = i; else if (TensorName == "style_params") StyleParamsInputTensorIndex = i;
} }
check(ContentInputTensorIndex != INDEX_NONE); check(ContentInputTensorIndex != INDEX_NONE);
check(StyleWeightsInputTensorIndex != INDEX_NONE);
check(StyleParamsInputTensorIndex != INDEX_NONE); check(StyleParamsInputTensorIndex != INDEX_NONE);
} }
@ -381,11 +380,15 @@ FScreenPassTexture FStyleTransferSceneViewExtension::PostProcessPassAfterTonemap
const FViewInfo& ViewInfo = static_cast<const FViewInfo&>(View); const FViewInfo& ViewInfo = static_cast<const FViewInfo&>(View);
const FNeuralTensor& StyleTransferContentInputTensor = StyleTransferNetwork->GetInputTensorForContext(*InferenceContext, ContentInputTensorIndex); const FNeuralTensor& StyleTransferContentInputTensor = StyleTransferNetwork->GetInputTensorForContext(*InferenceContext, ContentInputTensorIndex);
const FNeuralTensor& StyleTransferStyleWeightsInputTensor = StyleTransferNetwork->GetInputTensorForContext(*InferenceContext, StyleWeightsInputTensorIndex);
check(GScreenShadowMaskTexture); if (StyleWeightsInputTensorIndex != INDEX_NONE)
::TextureToTensorGrayscale(GraphBuilder, GScreenShadowMaskTexture, StyleTransferStyleWeightsInputTensor); {
const FNeuralTensor& StyleTransferStyleWeightsInputTensor = StyleTransferNetwork->GetInputTensorForContext(*InferenceContext, StyleWeightsInputTensorIndex);
check(GScreenShadowMaskTexture);
::TextureToTensorGrayscale(GraphBuilder, GScreenShadowMaskTexture, StyleTransferStyleWeightsInputTensor);
}
::TextureToTensorRGB(GraphBuilder, SceneColor.Texture, StyleTransferContentInputTensor); ::TextureToTensorRGB(GraphBuilder, SceneColor.Texture, StyleTransferContentInputTensor);
StyleTransferNetwork->Run(GraphBuilder, *InferenceContext); StyleTransferNetwork->Run(GraphBuilder, *InferenceContext);