refactor: add type parameter to layer inputs
This commit is contained in:
@@ -14,7 +14,7 @@ struct layer_input {
|
||||
static constexpr std::uint32_t TENSOR_TAG = 0x544E5352;
|
||||
};
|
||||
|
||||
template <std::size_t Features>
|
||||
template <std::size_t Features, typename T = float>
|
||||
class dense_input : public layer_input {
|
||||
template <typename Input, typename... Layers>
|
||||
friend class network;
|
||||
@@ -26,7 +26,8 @@ private:
|
||||
|
||||
static constexpr std::size_t FEATURES = Features;
|
||||
|
||||
using type = mat<1, FEATURES>;
|
||||
using inner_type = T;
|
||||
using type = mat<1, FEATURES, T>;
|
||||
|
||||
template <typename... Args, typename = std::enable_if_t<std::is_constructible_v<type, Args...>>>
|
||||
inner(Args&&... args)
|
||||
@@ -42,7 +43,7 @@ private:
|
||||
};
|
||||
};
|
||||
|
||||
template <std::size_t... Dims>
|
||||
template <typename T, std::size_t... Dims>
|
||||
class tensor_input : public layer_input {
|
||||
template <typename Input, typename... Layers>
|
||||
friend class network;
|
||||
@@ -52,7 +53,8 @@ private:
|
||||
struct inner final {
|
||||
static constexpr std::uint32_t TAG = TENSOR_TAG;
|
||||
|
||||
using type = tensor<double, Dims...>;
|
||||
using inner_type = T;
|
||||
using type = tensor<T, Dims...>;
|
||||
|
||||
template <typename... Args, typename = std::enable_if_t<std::is_constructible_v<type, Args...>>>
|
||||
inner(Args&&... args)
|
||||
|
||||
Reference in New Issue
Block a user