Loading...
Searching...
No Matches
c2psa_layer.h
Go to the documentation of this file.
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (C) 2026 Artificial Intelligence Techniques, S.L. and Roberto López González
3
4#pragma once
5
8
9namespace opennn
10{
11
12class C2PSA final : public Layer
13{
14public:
15
16 C2PSA(const Shape& = {}, const string& = "c2psa_layer");
17
18 Shape get_output_shape() const override { return input_shape; }
19
20 void set(const Shape&, const string&);
21 bool accepts_input_rank(Index rank) const override { return is_one_of(rank, 3); }
22
23 void apply_input_shape(const Shape& new_input_shape) override { set(new_input_shape, label); }
24
25 vector<TensorSpec> get_forward_specs(Index) const override;
26 vector<TensorSpec> get_backward_specs(Index) const override;
27
34
35 void on_compute_dtype_changed() override { c2psa.compute_dtype = get_compute_dtype(); }
36
37private:
38
39 C2PSAOperator c2psa;
40
41 using enum C2PSAOperator::Slot;
42
43 enum Backward {OutputDelta, InputDelta, BackwardScratch};
44
45 void configure_operator();
46};
47
48}
Shape get_output_shape() const override
Definition c2psa_layer.h:18
C2PSA(const Shape &={}, const string &="c2psa_layer")
void set(const Shape &, const string &)
vector< TensorSpec > get_backward_specs(Index) const override
ForwardSlotKind get_forward_slot_kind(size_t slot) const override
Definition c2psa_layer.h:28
void on_compute_dtype_changed() override
Definition c2psa_layer.h:35
bool accepts_input_rank(Index rank) const override
Definition c2psa_layer.h:21
void apply_input_shape(const Shape &new_input_shape) override
Definition c2psa_layer.h:23
vector< TensorSpec > get_forward_specs(Index) const override
Type get_compute_dtype() const noexcept
Definition layer.h:157
string label
Definition layer.h:215
Layer(LayerType type, Trainability trainability=Trainability::Trainable)
Definition layer.h:210
Shape input_shape
Definition layer.h:219
Definition configuration.h:10
constexpr bool is_one_of(const T &value, const Candidates &... candidates)
Definition opennn_types.h:273
ForwardSlotKind
Definition layer.h:18
@ Transient
Definition layer.h:18
@ Pooled
Definition layer.h:18
Definition c2psa_operator.h:12
Slot
Definition c2psa_operator.h:17
@ ForwardScratch
Definition c2psa_operator.h:25
Definition tensor_types.h:172