2 * Copyright (c) 2020 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "FillLayer.h"
19 #include "OperationUtils.h"
21 #include <cker/operation/Fill.h>
32 FillLayer::FillLayer() : _value(nullptr), _output(nullptr)
37 void FillLayer::configure(const IPortableTensor *value, IPortableTensor *output)
45 switch (_output->data_type())
47 case OperandType::FLOAT32:
48 nnfw::cker::Fill<float>(getBuffer<float>(_value), getShape(_output),
49 getBuffer<float>(_output));
51 case OperandType::INT32:
52 nnfw::cker::Fill<int32_t>(getBuffer<int32_t>(_value), getShape(_output),
53 getBuffer<int32_t>(_output));
55 case OperandType::INT64:
56 nnfw::cker::Fill<int64_t>(getBuffer<int64_t>(_value), getShape(_output),
57 getBuffer<int64_t>(_output));
59 case OperandType::UINT32:
60 nnfw::cker::Fill<uint32_t>(getBuffer<uint32_t>(_value), getShape(_output),
61 getBuffer<uint32_t>(_output));
64 throw std::runtime_error{"Fill: unsupported data type"};
70 } // namespace backend