As the title, I’ve trained an embedding function (e.g. inception-v1) with the last layer of an fc (e.g., 2048-dim vector as its output). In deployment, I want to append an L2-normalize operation after the fc layer and export the appended model (inception-v1 + fc2048 + l2norm) to onnx format? Without considering deployment in the form of trt, I know it is just adding a functional in the forward function of the model class. But in exporting to onnx format, it seems that the output name of a module is needed.
I’ve read this thread, and the problem seems to become to find a torch module equivalent of nn.functional.normalize()
, correct me if I was wrong.
And this thread seems useful. But I still can’t find the so call LpNormalization
mentioned by cfer8395.