提交 92923d08 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

Add builders for Landmarks2TransformMatrix layer

PiperOrigin-RevId: 286283327
Change-Id: I8fd9102c04ffe56af92fa19b01bcece139c45bae
上级 0088fbb3
......@@ -2333,6 +2333,38 @@ class TransformLandmarksOperationParser : public TFLiteOperationParser {
private:
};
class Landmarks2TransformMatrixOperationParser : public TFLiteOperationParser {
public:
Status IsSupported(const TfLiteContext* context,
const TfLiteNode* tflite_node,
const TfLiteRegistration* registration) final {
return CheckInputsOutputs(context, tflite_node, /*inputs=*/1,
/*outputs=*/1);
}
Status Parse(const TfLiteNode* tflite_node,
const TfLiteRegistration* registration, GraphFloat32* graph,
ObjectReader* reader) final {
Node* node = graph->NewNode();
RETURN_IF_ERROR(reader->AddInput(node, 0)); // landmarks
RETURN_IF_ERROR(reader->AddOutputs(node)); // transform matrix
const std::string op_name = "landmarks_to_transform_matrix";
node->operation.type = op_name;
BHWC output_shape;
RETURN_IF_ERROR(
ParseCustomAttributes(op_name, tflite_node->custom_initial_data,
tflite_node->custom_initial_data_size,
&(node->operation.attributes), &output_shape));
auto output_value = graph->FindOutputs(node->id)[0];
output_value->tensor.shape = output_shape;
return OkStatus();
}
private:
};
class UnsupportedOperationParser : public TFLiteOperationParser {
public:
Status IsSupported(const TfLiteContext* context,
......@@ -2450,6 +2482,10 @@ std::unique_ptr<TFLiteOperationParser> NewOperationParser(
return absl::make_unique<TransformLandmarksOperationParser>();
}
if (custom_name == "Landmarks2TransformMatrix") {
return absl::make_unique<Landmarks2TransformMatrixOperationParser>();
}
break;
}
return absl::make_unique<UnsupportedOperationParser>();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册