zoukankan      html  css  js  c++  java
  • frugally-deep: Header-only library for using Keras models in C++

        // Convenience wrapper around predict for models with
        // single tensor outputs of shape (1, 1, 1),
        // typically used for regression or binary classification.
        // Returns this one activation value.
        float_type predict_single_output(const tensor5s& inputs) const
        {
            const tensor5s outputs = predict(inputs);
            internal::assertion(outputs.size() == 1,
                "invalid number of outputs");
            const auto output_shape = outputs.front().shape();
            internal::assertion(output_shape.volume() == 1,
                "invalid output shape");
            return outputs.front().get(0, 0, 0, 0, 0);
    }
    

    convert tensor5 datatype to std::vector

    const std::vector<float> result_vec = *result.front().as_vector();
    
  • 相关阅读:
    Java
    Linux
    Linux
    Linux
    Java
    Ansible
    Ansible
    Java
    ACM&OI 基础数论算法专题
    题解 P4781 【【模板】拉格朗日插值】
  • 原文地址:https://www.cnblogs.com/yaos/p/10526907.html
Copyright © 2011-2022 走看看