cMHN 1.2
C++ library for learning MHNs with pRC
Loading...
Searching...
No Matches
squeeze.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-2-Clause
2
3#ifndef pRC_CORE_TENSOR_FUNCTIONS_SQUEEZE_H
4#define pRC_CORE_TENSOR_FUNCTIONS_SQUEEZE_H
5
10
11namespace pRC
12{
13 template<class X, IsTensorish R = RemoveReference<X>>
14 static inline constexpr auto squeeze(X &&a)
15 {
17 [&a](auto const... seq)
18 {
19 return expand(
20 filter<NotFn<IsUnit>>(Sequence<Size, R::size(seq)...>()),
21 [&a](auto const... sizes)
22 {
23 return reshape<sizes...>(forward<X>(a));
24 });
25 });
26 }
27}
28#endif // pRC_CORE_TENSOR_FUNCTIONS_SQUEEZE_H
Definition sequence.hpp:29
Definition cholesky.hpp:10
std::size_t Size
Definition basics.hpp:31
static constexpr auto squeeze(X &&a)
Definition squeeze.hpp:14
static constexpr auto filter(Sequence< T, Is... > const)
Definition sequence.hpp:543
static constexpr auto reshape(X &&a)
Definition reshape.hpp:14
static constexpr auto makeSeries()
Definition sequence.hpp:390
static constexpr decltype(auto) expand(Sequence< T, Seq... > const, F &&f, Xs &&...args)
Definition sequence.hpp:383
Definition not_fn.hpp:13