Skip to content

Commit

Permalink
[luci/pass] Introduce VerifyQuantizedNodeGranularity (Samsung#8238)
Browse files Browse the repository at this point in the history
This commit introduces `VerifyQuantizedNodeGranularity`,
which is base class of `VerifyQuantizedChannelWiseGranularity` and
`VerifyQuantizedLayerWiseGranularity`.

ONE-DCO-1.0-Signed-off-by: Seok NamKoong <[email protected]>
  • Loading branch information
llFreetimell authored Jan 4, 2022
1 parent 77b05ae commit 8239a9f
Show file tree
Hide file tree
Showing 2 changed files with 638 additions and 0 deletions.
38 changes: 38 additions & 0 deletions compiler/luci/pass/src/VerifyQuantizedNodeGranularity.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2022 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 "VerifyQuantizedNodeGranularity.h"

#include <luci/IR/CircleNodes.h>
#include <luci/Pass/QuantizationParameters.h>

#include <memory>

namespace luci
{

std::shared_ptr<VerifyQuantizedNodeGranularity>
VerifyQuantizedNodeGranularity::create(Granularity granularity)
{
if (granularity == Granularity::ChannelWise)
return std::make_shared<VerifyQuantizedNodeChannelWiseGranularity>();
else if (granularity == Granularity::LayerWise)
return std::make_shared<VerifyQuantizedNodeLayerWiseGranularity>();
else
throw std::domain_error("Not supported Granularity type");
}

} // namespace luci
Loading

0 comments on commit 8239a9f

Please sign in to comment.