File: input_layer.hpp

package info (click to toggle)
frugally-deep 0.18.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,036 kB
  • sloc: cpp: 6,680; python: 1,262; makefile: 4; sh: 1
file content (36 lines) | stat: -rw-r--r-- 940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2016, Tobias Hermann.
// https://github.com/Dobiasd/frugally-deep
// Distributed under the MIT License.
// (See accompanying LICENSE file or at
//  https://opensource.org/licenses/MIT)

#pragma once

#include "fdeep/layers/layer.hpp"

#include <string>

namespace fdeep {
namespace internal {

    class input_layer : public layer {
    public:
        explicit input_layer(const std::string& name, const tensor_shape_variable& input_shape)
            : layer(name)
            , input_shape_(input_shape)
        {
        }

    protected:
        tensors apply_impl(const tensors& inputs) const override
        {
            raise_error("Input layer should not be called.");
            assertion(inputs.size() == 1, "need exactly one input");
            assertion(inputs.front().shape() == input_shape_, "invalid input size");
            return inputs;
        }
        tensor_shape_variable input_shape_;
    };

}
}