// 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/common.hpp" #include "fdeep/shape_hw_variable.hpp" #include "fdeep/shape_hw.hpp" #include #include #include #include #include namespace fdeep { namespace internal { class shape_hwc_variable { public: explicit shape_hwc_variable( fplus::maybe height, fplus::maybe width, fplus::maybe depth) : height_(height), width_(width), depth_(depth) { } shape_hw_variable without_depth() const { return shape_hw_variable(height_, width_); } fplus::maybe height_; fplus::maybe width_; fplus::maybe depth_; }; inline bool operator == (const shape_hwc_variable& lhs, const shape_hwc_variable& rhs) { return lhs.height_ == rhs.height_ && lhs.width_ == rhs.width_ && lhs.depth_ == rhs.depth_; } inline bool operator != (const shape_hwc_variable& lhs, const shape_hwc_variable& rhs) { return !(lhs == rhs); } } // namespace internal using shape_hwc_variable = internal::shape_hwc_variable; inline std::string show_shape_hwc_variable(const shape_hwc_variable& s) { const std::vector> dimensions = {s.height_, s.width_, s.depth_}; const auto dimensions_repr = fplus::transform( fplus::show_maybe, dimensions); return fplus::show_cont_with_frame(", ", "(", ")", dimensions_repr); } inline std::string show_shape_hwcs_variable( const std::vector& shapes) { return fplus::show_cont(fplus::transform(show_shape_hwc_variable, shapes)); } } // namespace fdeep