-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[circlechef] Support Quantize/Dequantize Ops (#14308)
This supports Quantize, Dequantize Ops. ONE-DCO-1.0-Signed-off-by: Hyukjin Jeong <[email protected]>
- Loading branch information
1 parent
75f98dd
commit f999023
Showing
6 changed files
with
160 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "Dequantize.h" | ||
|
||
#include "Convert.h" | ||
|
||
flatbuffers::Offset<void> DequantizeChef::value(flatbuffers::FlatBufferBuilder &fbb) const | ||
{ | ||
return flatbuffers::Offset<void>(); | ||
} | ||
|
||
std::unique_ptr<OpChef> DequantizeChefFactory::create(const circlechef::Operation *operation) const | ||
{ | ||
return std::unique_ptr<OpChef>{new DequantizeChef{operation}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __OP_DEQUANTIZE_H__ | ||
#define __OP_DEQUANTIZE_H__ | ||
|
||
#include "OpChef.h" | ||
|
||
class DequantizeChef final : public OpChef | ||
{ | ||
public: | ||
explicit DequantizeChef(const circlechef::Operation *operation) : _operation{operation} | ||
{ | ||
// DO NOTHING | ||
} | ||
|
||
public: | ||
circle::BuiltinOperator code(void) const override { return circle::BuiltinOperator_DEQUANTIZE; } | ||
|
||
circle::BuiltinOptions type(void) const override | ||
{ | ||
return circle::BuiltinOptions_DequantizeOptions; | ||
} | ||
|
||
flatbuffers::Offset<void> value(flatbuffers::FlatBufferBuilder &fbb) const override; | ||
|
||
private: | ||
const circlechef::Operation *_operation; | ||
}; | ||
|
||
struct DequantizeChefFactory final : public OpChefFactory | ||
{ | ||
std::unique_ptr<OpChef> create(const circlechef::Operation *operation) const override; | ||
}; | ||
|
||
#endif // __OP_DEQUANTIZE_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "Quantize.h" | ||
|
||
#include "Convert.h" | ||
|
||
flatbuffers::Offset<void> QuantizeChef::value(flatbuffers::FlatBufferBuilder &fbb) const | ||
{ | ||
return flatbuffers::Offset<void>(); | ||
} | ||
|
||
std::unique_ptr<OpChef> QuantizeChefFactory::create(const circlechef::Operation *operation) const | ||
{ | ||
return std::unique_ptr<OpChef>{new QuantizeChef{operation}}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef __OP_QUANTIZE_H__ | ||
#define __OP_QUANTIZE_H__ | ||
|
||
#include "OpChef.h" | ||
|
||
class QuantizeChef final : public OpChef | ||
{ | ||
public: | ||
explicit QuantizeChef(const circlechef::Operation *operation) : _operation{operation} | ||
{ | ||
// DO NOTHING | ||
} | ||
|
||
public: | ||
circle::BuiltinOperator code(void) const override { return circle::BuiltinOperator_QUANTIZE; } | ||
|
||
circle::BuiltinOptions type(void) const override | ||
{ | ||
return circle::BuiltinOptions_QuantizeOptions; | ||
} | ||
|
||
flatbuffers::Offset<void> value(flatbuffers::FlatBufferBuilder &fbb) const override; | ||
|
||
private: | ||
const circlechef::Operation *_operation; | ||
}; | ||
|
||
struct QuantizeChefFactory final : public OpChefFactory | ||
{ | ||
std::unique_ptr<OpChef> create(const circlechef::Operation *operation) const override; | ||
}; | ||
|
||
#endif // __OP_QUANTIZE_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters