mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00

G-API: Implement PlaidML2 backend * PlaidML backend init version * Add test * Support multiply inputs/outputs in PlaidML2 backend * Fix comment to review * Add HAVE_PLAIDML macros * Move plaidml tests to separate file * Fix comment to review * Fix cmake warning * Fix comments to review * Fix typos overload -> overflow * Fix comments to review * Clean up * Remove spaces from cmake scripts * Disable tests with bitwise operations * Use plaidml::exec::Binder
43 lines
987 B
C++
43 lines
987 B
C++
// This file is part of OpenCV project.
|
|
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
|
// of this distribution and at http://opencv.org/license.html.
|
|
//
|
|
// Copyright (C) 2019 Intel Corporation
|
|
|
|
|
|
#ifdef HAVE_PLAIDML
|
|
|
|
#ifndef OPENCV_GAPI_PLAIDML_UTIL_HPP
|
|
#define OPENCV_GAPI_PLAIDML_UTIL_HPP
|
|
|
|
#include <plaidml2/core/ffi.h>
|
|
|
|
namespace cv
|
|
{
|
|
namespace util
|
|
{
|
|
namespace plaidml
|
|
{
|
|
|
|
inline plaidml_datatype depth_from_ocv(int depth)
|
|
{
|
|
switch(depth)
|
|
{
|
|
case CV_8U : return PLAIDML_DATA_UINT8;
|
|
case CV_8S : return PLAIDML_DATA_INT8;
|
|
case CV_16U : return PLAIDML_DATA_UINT16;
|
|
case CV_16S : return PLAIDML_DATA_INT16;
|
|
case CV_32S : return PLAIDML_DATA_INT32;
|
|
case CV_32F : return PLAIDML_DATA_FLOAT32;
|
|
case CV_64F : return PLAIDML_DATA_FLOAT64;
|
|
default: util::throw_error("Unrecognized OpenCV depth");
|
|
}
|
|
};
|
|
|
|
}
|
|
}
|
|
}
|
|
#endif // OPENCV_GAPI_PLAIDML_UTIL_HPP
|
|
|
|
#endif // HAVE_PLAIDML
|