[CPU] Convert precisions on inputs/outputs (#8805)
This commit is contained in:
1 parent
2514c0ef38
commit
6ddc47a7ef
15 files changed
+725
-182
No files matched your search
@@ -504,23 +504,24 @@ Engine::LoadExeNetworkImpl(const InferenceEngine::CNNNetwork &network, const std
|
||||
OV_ITT_SCOPED_TASK(itt::domains::MKLDNNPlugin, "Engine::LoadExeNetworkImpl");
|
||||
|
||||
// verification of supported input
|
||||
InferenceEngine::InputsDataMap _networkInputs = network.getInputsInfo();
|
||||
for (const auto &ii : _networkInputs) {
|
||||
for (const auto &ii : network.getInputsInfo()) {
|
||||
auto input_precision = ii.second->getPrecision();
|
||||
if (input_precision != InferenceEngine::Precision::FP64 &&
|
||||
input_precision != InferenceEngine::Precision::FP32 &&
|
||||
input_precision != InferenceEngine::Precision::I32 &&
|
||||
input_precision != InferenceEngine::Precision::U32 &&
|
||||
input_precision != InferenceEngine::Precision::U16 &&
|
||||
input_precision != InferenceEngine::Precision::I16 &&
|
||||
input_precision != InferenceEngine::Precision::I8 &&
|
||||
input_precision != InferenceEngine::Precision::U8 &&
|
||||
input_precision != InferenceEngine::Precision::BF16 &&
|
||||
input_precision != InferenceEngine::Precision::BOOL &&
|
||||
input_precision != InferenceEngine::Precision::I64 &&
|
||||
input_precision != InferenceEngine::Precision::U64) {
|
||||
|
||||
using hash_t = std::hash<typename std::underlying_type<Precision::ePrecision>::type>;
|
||||
|
||||
static const std::unordered_set<Precision::ePrecision, hash_t> supported_precisions = {
|
||||
Precision::U8, Precision::I8,
|
||||
Precision::U16, Precision::I16,
|
||||
Precision::U32, Precision::I32,
|
||||
Precision::U64, Precision::I64,
|
||||
Precision::BF16, Precision::FP16,
|
||||
Precision::FP32, Precision::FP64,
|
||||
Precision::BOOL
|
||||
};
|
||||
|
||||
if (!supported_precisions.count(input_precision)) {
|
||||
IE_THROW(NotImplemented)
|
||||
<< "Input image format " << input_precision << " is not supported yet...";
|
||||
<< "Input image format " << input_precision << " is not supported yet...";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,27 +4,208 @@
|
||||
|
||||
#include "cpu_convert.h"
|
||||
#include "cpu_memcpy.h"
|
||||
#include "utils/bfloat16.hpp"
|
||||
#include <utils/bfloat16.hpp>
|
||||
#include <utils/general_utils.h>
|
||||
#include <mkldnn_selective_build.h>
|
||||
#include <ie_parallel.hpp>
|
||||
#include <openvino/core/type/float16.hpp>
|
||||
#include <cpu/x64/jit_generator.hpp>
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include <tuple>
|
||||
#include <ie_parallel.hpp>
|
||||
#include <cmath>
|
||||
|
||||
using namespace MKLDNNPlugin;
|
||||
using namespace InferenceEngine;
|
||||
using namespace dnnl::impl::cpu::x64;
|
||||
using namespace dnnl::impl::utils;
|
||||
using namespace Xbyak;
|
||||
|
||||
namespace {
|
||||
|
||||
template<typename srcType, typename dstType>
|
||||
void convert(const void *srcPtr, void *dstPtr, const size_t size) {
|
||||
if (std::is_same<srcType, dstType>::value) {
|
||||
cpu_memcpy(dstPtr, srcPtr, size*sizeof(dstType));
|
||||
} else {
|
||||
const srcType *srcData = reinterpret_cast<const srcType *>(srcPtr);
|
||||
dstType *dstData = reinterpret_cast<dstType *>(dstPtr);
|
||||
template <typename src_t, typename dst_t>
|
||||
void convert_vec(jit_generator & gen,
|
||||
const RegExp & src,
|
||||
const RegExp & dst);
|
||||
|
||||
parallel_for(size, [&](size_t i) {
|
||||
dstData[i] = static_cast<dstType>(srcData[i]);
|
||||
template <>
|
||||
void convert_vec<ov::float16, float>(jit_generator & gen,
|
||||
const RegExp & src,
|
||||
const RegExp & dst) {
|
||||
auto const & f16vec = gen.xmm3;
|
||||
auto const & f32vec = gen.ymm4;
|
||||
|
||||
gen.movdqu(f16vec, gen.xword[src]);
|
||||
gen.vcvtph2ps(f32vec, f16vec);
|
||||
gen.vmovups(gen.yword[dst], f32vec);
|
||||
}
|
||||
|
||||
template <>
|
||||
void convert_vec<float, ov::float16>(jit_generator & gen,
|
||||
const RegExp & src,
|
||||
const RegExp & dst) {
|
||||
auto const & f16vec = gen.xmm3;
|
||||
auto const & f32vec = gen.ymm4;
|
||||
|
||||
gen.vmovups(f32vec, gen.yword[src]);
|
||||
gen.vcvtps2ph(f16vec, f32vec, 0);
|
||||
gen.movdqu(gen.xword[dst], f16vec);
|
||||
}
|
||||
|
||||
class jit_convert_array : public jit_generator {
|
||||
DECLARE_CPU_JIT_AUX_FUNCTIONS(jit_convert_array)
|
||||
|
||||
void generate() override {
|
||||
const size_t vlen = 8u;
|
||||
const size_t vlen_log2 = 3;
|
||||
|
||||
auto reg_src = rax;
|
||||
auto reg_dst = rbx;
|
||||
auto reg_sz = rdx;
|
||||
|
||||
Label tail, exit;
|
||||
|
||||
preamble();
|
||||
|
||||
mov(reg_src, ptr[param1 + offsetof(args_t, src)]);
|
||||
mov(reg_dst, ptr[param1 + offsetof(args_t, out)]);
|
||||
mov(reg_sz, ptr[param1 + offsetof(args_t, count)]);
|
||||
|
||||
xor_(rsi, rsi);
|
||||
mov(r8, reg_sz);
|
||||
shr(r8, vlen_log2);
|
||||
|
||||
foreach(rsi, 1, r8, [&, this](const Xbyak::Reg64& idx) {
|
||||
_convert_vec(*this, reg_src, reg_dst);
|
||||
add(reg_src, _src_size * vlen);
|
||||
add(reg_dst, _dst_size * vlen);
|
||||
});
|
||||
|
||||
L(tail);
|
||||
|
||||
shl(rsi, vlen_log2);
|
||||
sub(reg_sz, rsi);
|
||||
test(reg_sz, reg_sz);
|
||||
jz(exit);
|
||||
|
||||
// allocate array for 8 floats on stack
|
||||
sub(rsp, vlen * sizeof(float));
|
||||
mov(r8, rsp);
|
||||
|
||||
vpxor(ymm4, ymm4, ymm4);
|
||||
vmovups(yword[r8], ymm4);
|
||||
|
||||
// Tail conversion
|
||||
copy(r8, reg_src, reg_sz, _src_size);
|
||||
_convert_vec(*this, r8, r8);
|
||||
copy(reg_dst, r8, reg_sz, _dst_size);
|
||||
|
||||
// Free the array on stack
|
||||
add(rsp, vlen * sizeof(float));
|
||||
|
||||
L(exit);
|
||||
|
||||
postamble();
|
||||
}
|
||||
|
||||
void foreach(const Xbyak::Reg64& idx,
|
||||
size_t step,
|
||||
const Xbyak::Reg64& end,
|
||||
std::function<void(const Xbyak::Reg64&)> && fn) {
|
||||
Label loop, exit;
|
||||
|
||||
L(loop);
|
||||
cmp(idx, end);
|
||||
jge(exit);
|
||||
|
||||
fn(idx);
|
||||
|
||||
add(idx, step);
|
||||
jmp(loop);
|
||||
L(exit);
|
||||
}
|
||||
|
||||
void copy(const Xbyak::Reg64& dst,
|
||||
const Xbyak::Reg64& src,
|
||||
const Xbyak::Reg64& size,
|
||||
size_t item_size) {
|
||||
push(rsi);
|
||||
push(r15);
|
||||
|
||||
xor_(rsi, rsi);
|
||||
|
||||
auto address_frame = [this](size_t size) -> const AddressFrame& {
|
||||
switch (size) {
|
||||
case 1: return byte;
|
||||
case 2: return word;
|
||||
case 4: return dword;
|
||||
case 8: return qword;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ptr;
|
||||
};
|
||||
|
||||
const auto & addr_frame = address_frame(item_size);
|
||||
|
||||
foreach(rsi, 1, size, [&, this](const Xbyak::Reg64& idx) {
|
||||
mov(r15, addr_frame[src + idx * item_size]);
|
||||
mov(addr_frame[dst + idx * item_size], r15);
|
||||
});
|
||||
|
||||
pop(r15);
|
||||
pop(rsi);
|
||||
}
|
||||
|
||||
public:
|
||||
typedef struct {
|
||||
const void* src;
|
||||
void* out;
|
||||
const size_t count;
|
||||
} args_t;
|
||||
|
||||
typedef void (*fn_t)(const args_t*);
|
||||
|
||||
typedef void (*convert_vec_t)(jit_generator &,
|
||||
const RegExp &,
|
||||
const RegExp &);
|
||||
|
||||
jit_convert_array(convert_vec_t convert_vec,
|
||||
size_t src_size,
|
||||
size_t dst_size)
|
||||
: _convert_vec(convert_vec)
|
||||
, _src_size(src_size)
|
||||
, _dst_size(dst_size) {}
|
||||
|
||||
template<typename src_t, typename dst_t>
|
||||
static fn_t get() {
|
||||
if (mayiuse(avx2) && cpu().has(util::Cpu::tF16C)) {
|
||||
static jit_convert_array converter(convert_vec<src_t, dst_t>, sizeof(src_t), sizeof(dst_t));
|
||||
auto & generator = static_cast<jit_generator&>(converter);
|
||||
generator.create_kernel();
|
||||
return (fn_t)generator.jit_ker();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
convert_vec_t _convert_vec;
|
||||
size_t _src_size;
|
||||
size_t _dst_size;
|
||||
};
|
||||
|
||||
template <typename TI, typename TO>
|
||||
void jit_convert(const TI* arg, TO* out, size_t count) {
|
||||
using jit_impl = jit_convert_array;
|
||||
static auto converter = jit_impl::get<TI, TO>();
|
||||
|
||||
if (converter) {
|
||||
typename jit_impl::args_t args = { arg, out, count };
|
||||
converter(&args);
|
||||
} else {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
out[i] = static_cast<TO>(arg[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,84 +216,391 @@ struct PrecisionInfo {
|
||||
|
||||
template <>
|
||||
struct PrecisionInfo<Precision::BF16> {
|
||||
using value_type = MKLDNNPlugin::bfloat16_t;
|
||||
using value_type = bfloat16_t;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PrecisionInfo<Precision::FP16> {
|
||||
using value_type = ov::float16;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct PrecisionInfo<Precision::BOOL> {
|
||||
using value_type = uint8_t;
|
||||
};
|
||||
|
||||
template<typename T,
|
||||
typename U = typename std::conditional<
|
||||
std::is_same<ov::float16, T>::value
|
||||
|| std::is_same<bfloat16_t, T>::value,
|
||||
float, T>::type>
|
||||
struct Range {
|
||||
const std::tuple<U, U> & fit(const Precision & prec);
|
||||
|
||||
private:
|
||||
std::tuple<U, U> _range {
|
||||
std::numeric_limits<T>::lowest(),
|
||||
std::numeric_limits<T>::max()
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
const std::tuple<U, U> & Range<T, U>::fit(const Precision & prec) {
|
||||
if (prec.is_float()) {
|
||||
double lbound, ubound;
|
||||
switch (prec) {
|
||||
case Precision::BF16:
|
||||
lbound = static_cast<double>(std::numeric_limits<bfloat16_t>::lowest());
|
||||
ubound = static_cast<double>(std::numeric_limits<bfloat16_t>::max());
|
||||
break;
|
||||
case Precision::FP16:
|
||||
lbound = static_cast<double>(std::numeric_limits<ov::float16>::lowest());
|
||||
ubound = static_cast<double>(std::numeric_limits<ov::float16>::max());
|
||||
break;
|
||||
case Precision::FP32:
|
||||
lbound = static_cast<double>(std::numeric_limits<float>::lowest());
|
||||
ubound = static_cast<double>(std::numeric_limits<float>::max());
|
||||
break;
|
||||
case Precision::FP64:
|
||||
lbound = std::numeric_limits<double>::lowest();
|
||||
ubound = std::numeric_limits<double>::max();
|
||||
break;
|
||||
default:
|
||||
IE_THROW() << "Unsupported precision";
|
||||
}
|
||||
std::get<0>(_range) = static_cast<U>(std::max(static_cast<double>(std::get<0>(_range)), lbound));
|
||||
std::get<1>(_range) = static_cast<U>(std::min(static_cast<double>(std::get<1>(_range)), ubound));
|
||||
} else {
|
||||
int64_t lbound;
|
||||
uint64_t ubound;
|
||||
switch (prec) {
|
||||
case Precision::BOOL:
|
||||
case Precision::U8:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<uint8_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<uint8_t>::max());
|
||||
break;
|
||||
case Precision::I8:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<int8_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<int8_t>::max());
|
||||
break;
|
||||
case Precision::U16:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<uint16_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max());
|
||||
break;
|
||||
case Precision::I16:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<int16_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<int16_t>::max());
|
||||
break;
|
||||
case Precision::U32:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<uint32_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<uint32_t>::max());
|
||||
break;
|
||||
case Precision::I32:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<int32_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
|
||||
break;
|
||||
case Precision::U64:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<uint64_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<uint64_t>::max());
|
||||
break;
|
||||
case Precision::I64:
|
||||
lbound = static_cast<int64_t>(std::numeric_limits<int64_t>::lowest());
|
||||
ubound = static_cast<uint64_t>(std::numeric_limits<int64_t>::max());
|
||||
break;
|
||||
default:
|
||||
IE_THROW() << "Unsupported precision";
|
||||
}
|
||||
using ltype = typename std::conditional<
|
||||
std::is_floating_point<U>::value,
|
||||
double, int64_t>::type;
|
||||
using utype = typename std::conditional<
|
||||
std::is_floating_point<U>::value,
|
||||
double, uint64_t>::type;
|
||||
std::get<0>(_range) = static_cast<U>(std::max(static_cast<ltype>(std::get<0>(_range)), static_cast<ltype>(lbound)));
|
||||
std::get<1>(_range) = static_cast<U>(std::min(static_cast<utype>(std::get<1>(_range)), static_cast<utype>(ubound)));
|
||||
}
|
||||
return _range;
|
||||
}
|
||||
|
||||
struct ConvertContext {
|
||||
const void *srcPtr;
|
||||
void *dstPtr;
|
||||
size_t size;
|
||||
Precision interimPrc;
|
||||
Precision dstPrc;
|
||||
bool converted;
|
||||
|
||||
template<typename T>
|
||||
std::tuple<T, T> range() const {
|
||||
Range<T> r;
|
||||
r.fit(interimPrc);
|
||||
return r.fit(dstPrc);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ConvertPrecision {
|
||||
using src_t = typename std::tuple_element<0, T>::type;
|
||||
using dst_t = typename std::tuple_element<1, T>::type;
|
||||
struct ConvertPrecision;
|
||||
|
||||
template<typename src_t, typename dst_t>
|
||||
struct ConvertPrecision<std::tuple<src_t, dst_t>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
convert<src_t, dst_t>(ctx.srcPtr, ctx.dstPtr, ctx.size);
|
||||
auto src = static_cast<const src_t *>(ctx.srcPtr);
|
||||
auto dst = static_cast<dst_t *>(ctx.dstPtr);
|
||||
src_t lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<src_t>();
|
||||
|
||||
if (std::is_integral<src_t>::value
|
||||
|| ctx.interimPrc.is_float()
|
||||
|| std::is_integral<dst_t>::value) {
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = static_cast<dst_t>(std::max(std::min(src[i], ubound), lbound));
|
||||
});
|
||||
} else {
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = static_cast<dst_t>(std::trunc(std::max(std::min(src[i], ubound), lbound)));
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConvertPrecision<std::tuple<float, bfloat16_t>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
auto src = static_cast<const float *>(ctx.srcPtr);
|
||||
auto dst = static_cast<bfloat16_t *>(ctx.dstPtr);
|
||||
|
||||
if (ctx.interimPrc.is_float()) {
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = static_cast<bfloat16_t>(src[i]);
|
||||
});
|
||||
} else {
|
||||
float lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<float>();
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = static_cast<bfloat16_t>(std::trunc(std::max(std::min(src[i], ubound), lbound)));
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConvertPrecision<std::tuple<bfloat16_t, float>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
auto src = static_cast<const bfloat16_t *>(ctx.srcPtr);
|
||||
auto dst = static_cast<float *>(ctx.dstPtr);
|
||||
|
||||
if (ctx.interimPrc.is_float()) {
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = static_cast<float>(src[i]);
|
||||
});
|
||||
} else {
|
||||
float lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<bfloat16_t>();
|
||||
parallel_for(ctx.size, [&](size_t i) {
|
||||
dst[i] = std::trunc(std::max(std::min(static_cast<float>(src[i]), ubound), lbound));
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename src_t>
|
||||
struct ConvertPrecision<std::tuple<src_t, ov::float16>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
auto src = static_cast<const src_t *>(ctx.srcPtr);
|
||||
auto dst = static_cast<ov::float16 *>(ctx.dstPtr);
|
||||
|
||||
constexpr size_t batch = 64;
|
||||
const size_t iterations = MKLDNNPlugin::div_up(ctx.size, batch);
|
||||
typedef float batch_type[batch];
|
||||
|
||||
src_t lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<src_t>();
|
||||
|
||||
if (std::is_integral<src_t>::value
|
||||
|| ctx.interimPrc.is_float()) {
|
||||
parallel_for(iterations, [&](size_t i) {
|
||||
batch_type tmp;
|
||||
const size_t offset = i * batch;
|
||||
const size_t current_batch_size = std::min(ctx.size - offset, batch);
|
||||
for (size_t j = 0; j < current_batch_size; ++j) // src_t -> fp32
|
||||
tmp[j] = static_cast<float>(std::max(std::min(src[offset + j], ubound), lbound));
|
||||
jit_convert(tmp, dst + offset, current_batch_size); // fp32 -> fp16
|
||||
});
|
||||
} else {
|
||||
parallel_for(iterations, [&](size_t i) {
|
||||
batch_type tmp;
|
||||
const size_t offset = i * batch;
|
||||
const size_t current_batch_size = std::min(ctx.size - offset, batch);
|
||||
for (size_t j = 0; j < current_batch_size; ++j) // src_t -> fp32
|
||||
tmp[j] = static_cast<float>(std::trunc(std::max(std::min(src[offset + j], ubound), lbound)));
|
||||
jit_convert(tmp, dst + offset, current_batch_size); // fp32 -> fp16
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename dst_t>
|
||||
struct ConvertPrecision<std::tuple<ov::float16, dst_t>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
auto src = static_cast<const ov::float16 *>(ctx.srcPtr);
|
||||
auto dst = static_cast<dst_t *>(ctx.dstPtr);
|
||||
|
||||
constexpr size_t batch = 64;
|
||||
const size_t iterations = MKLDNNPlugin::div_up(ctx.size, batch);
|
||||
typedef float batch_type[batch];
|
||||
|
||||
float lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<ov::float16>();
|
||||
|
||||
if (ctx.interimPrc.is_float()
|
||||
|| std::is_integral<dst_t>::value) {
|
||||
parallel_for(iterations, [&](size_t i) {
|
||||
batch_type tmp;
|
||||
const size_t offset = i * batch;
|
||||
const size_t current_batch_size = std::min(ctx.size - offset, batch);
|
||||
jit_convert(src + offset, tmp, current_batch_size); // fp16 -> fp32
|
||||
for (size_t j = 0; j < current_batch_size; ++j) // fp32 -> dst_t
|
||||
dst[offset + j] = static_cast<dst_t>(std::max(std::min(tmp[j], ubound), lbound));
|
||||
});
|
||||
} else {
|
||||
parallel_for(iterations, [&](size_t i) {
|
||||
batch_type tmp;
|
||||
const size_t offset = i * batch;
|
||||
const size_t current_batch_size = std::min(ctx.size - offset, batch);
|
||||
jit_convert(src + offset, tmp, current_batch_size); // fp16 -> fp32
|
||||
for (size_t j = 0; j < current_batch_size; ++j) // fp32 -> dst_t
|
||||
dst[offset + j] = static_cast<dst_t>(std::trunc(std::max(std::min(tmp[j], ubound), lbound)));
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ConvertPrecision<std::tuple<ov::float16, ov::float16>> {
|
||||
void operator()(ConvertContext & ctx) {
|
||||
auto src = static_cast<const ov::float16 *>(ctx.srcPtr);
|
||||
auto dst = static_cast<ov::float16 *>(ctx.dstPtr);
|
||||
|
||||
constexpr size_t batch = 64;
|
||||
const size_t iterations = MKLDNNPlugin::div_up(ctx.size, batch);
|
||||
typedef float batch_type[batch];
|
||||
|
||||
float lbound, ubound;
|
||||
std::tie(lbound, ubound) = ctx.range<ov::float16>();
|
||||
|
||||
if (ctx.interimPrc.is_float()) {
|
||||
cpu_memcpy(dst, src, ctx.size * sizeof(ov::float16));
|
||||
} else {
|
||||
parallel_for(iterations, [&](size_t i) {
|
||||
batch_type tmp;
|
||||
const size_t offset = i * batch;
|
||||
const size_t current_batch_size = std::min(ctx.size - offset, batch);
|
||||
jit_convert(src + offset, tmp, current_batch_size); // fp16 -> fp32
|
||||
for (size_t j = 0; j < current_batch_size; ++j) // truncate fp32
|
||||
tmp[j] = std::trunc(std::max(std::min(tmp[j], ubound), lbound));
|
||||
jit_convert(tmp, dst + offset, current_batch_size); // fp32 -> fp16
|
||||
});
|
||||
}
|
||||
|
||||
ctx.converted = true;
|
||||
}
|
||||
};
|
||||
|
||||
bool isConversionTruncatesRange(const Precision & from, const Precision & to) {
|
||||
return to.bitsSize() < from.bitsSize()
|
||||
|| (from.is_float() && !to.is_float()) // float -> integral
|
||||
|| (from.isSigned() != to.isSigned()) // signed <-> unsigned
|
||||
|| (to == Precision::BOOL && from != to); // T -> bool
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#define MKLDNN_CVT(ST, DT) OV_CASE2(Precision::ST, Precision::DT, PrecisionInfo<Precision::ST>::value_type, PrecisionInfo<Precision::DT>::value_type)
|
||||
|
||||
void cpu_convert(const void *srcPtr, void *dstPtr, Precision srcPrc, Precision dstPrc, const size_t size) {
|
||||
using namespace MKLDNNPlugin;
|
||||
#define MKLDNN_CVT_LIST \
|
||||
MKLDNN_CVT(U8, I8), MKLDNN_CVT(U8, U16), MKLDNN_CVT(U8, I16), MKLDNN_CVT(U8, U32), \
|
||||
MKLDNN_CVT(U8, I32), MKLDNN_CVT(U8, U64), MKLDNN_CVT(U8, I64), MKLDNN_CVT(U8, FP32), \
|
||||
MKLDNN_CVT(U8, FP16), MKLDNN_CVT(U8, BF16), MKLDNN_CVT(U8, FP64), MKLDNN_CVT(U8, BOOL), \
|
||||
MKLDNN_CVT(I8, U8), MKLDNN_CVT(I8, U16), MKLDNN_CVT(I8, I16), MKLDNN_CVT(I8, U32), \
|
||||
MKLDNN_CVT(I8, I32), MKLDNN_CVT(I8, U64), MKLDNN_CVT(I8, I64), MKLDNN_CVT(I8, FP32), \
|
||||
MKLDNN_CVT(I8, FP16), MKLDNN_CVT(I8, BF16), MKLDNN_CVT(I8, FP64), MKLDNN_CVT(I8, BOOL), \
|
||||
MKLDNN_CVT(U16, U8), MKLDNN_CVT(U16, I8), MKLDNN_CVT(U16, I16), MKLDNN_CVT(U16, U32), \
|
||||
MKLDNN_CVT(U16, I32), MKLDNN_CVT(U16, U64), MKLDNN_CVT(U16, I64), MKLDNN_CVT(U16, FP32), \
|
||||
MKLDNN_CVT(U16, FP16), MKLDNN_CVT(U16, BF16), MKLDNN_CVT(U16, FP64), MKLDNN_CVT(U16, BOOL), \
|
||||
MKLDNN_CVT(I16, U8), MKLDNN_CVT(I16, I8), MKLDNN_CVT(I16, U16), MKLDNN_CVT(I16, U32), \
|
||||
MKLDNN_CVT(I16, I32), MKLDNN_CVT(I16, U64), MKLDNN_CVT(I16, I64), MKLDNN_CVT(I16, FP32), \
|
||||
MKLDNN_CVT(I16, FP16), MKLDNN_CVT(I16, BF16), MKLDNN_CVT(I16, FP64), MKLDNN_CVT(I16, BOOL), \
|
||||
MKLDNN_CVT(U32, U8), MKLDNN_CVT(U32, I8), MKLDNN_CVT(U32, U16), MKLDNN_CVT(U32, I16), \
|
||||
MKLDNN_CVT(U32, I32), MKLDNN_CVT(U32, U64), MKLDNN_CVT(U32, I64), MKLDNN_CVT(U32, FP32), \
|
||||
MKLDNN_CVT(U32, FP16), MKLDNN_CVT(U32, BF16), MKLDNN_CVT(U32, FP64), MKLDNN_CVT(U32, BOOL), \
|
||||
MKLDNN_CVT(I32, U8), MKLDNN_CVT(I32, I8), MKLDNN_CVT(I32, U16), MKLDNN_CVT(I32, I16), \
|
||||
MKLDNN_CVT(I32, U32), MKLDNN_CVT(I32, U64), MKLDNN_CVT(I32, I64), MKLDNN_CVT(I32, FP32), \
|
||||
MKLDNN_CVT(I32, FP16), MKLDNN_CVT(I32, BF16), MKLDNN_CVT(I32, FP64), MKLDNN_CVT(I32, BOOL), \
|
||||
MKLDNN_CVT(U64, U8), MKLDNN_CVT(U64, I8), MKLDNN_CVT(U64, U16), MKLDNN_CVT(U64, I16), \
|
||||
MKLDNN_CVT(U64, U32), MKLDNN_CVT(U64, I32), MKLDNN_CVT(U64, I64), MKLDNN_CVT(U64, FP32), \
|
||||
MKLDNN_CVT(U64, FP16), MKLDNN_CVT(U64, BF16), MKLDNN_CVT(U64, FP64), MKLDNN_CVT(U64, BOOL), \
|
||||
MKLDNN_CVT(I64, U8), MKLDNN_CVT(I64, I8), MKLDNN_CVT(I64, U16), MKLDNN_CVT(I64, I16), \
|
||||
MKLDNN_CVT(I64, U32), MKLDNN_CVT(I64, I32), MKLDNN_CVT(I64, U64), MKLDNN_CVT(I64, FP32), \
|
||||
MKLDNN_CVT(I64, FP16), MKLDNN_CVT(I64, BF16), MKLDNN_CVT(I64, FP64), MKLDNN_CVT(I64, BOOL), \
|
||||
MKLDNN_CVT(FP32, U8), MKLDNN_CVT(FP32, I8), MKLDNN_CVT(FP32, U16), MKLDNN_CVT(FP32, I16), \
|
||||
MKLDNN_CVT(FP32, U32), MKLDNN_CVT(FP32, I32), MKLDNN_CVT(FP32, U64), MKLDNN_CVT(FP32, I64), \
|
||||
MKLDNN_CVT(FP32, FP16), MKLDNN_CVT(FP32, BF16), MKLDNN_CVT(FP32, FP64), MKLDNN_CVT(FP32, BOOL), \
|
||||
MKLDNN_CVT(FP16, U8), MKLDNN_CVT(FP16, I8), MKLDNN_CVT(FP16, U16), MKLDNN_CVT(FP16, I16), \
|
||||
MKLDNN_CVT(FP16, U32), MKLDNN_CVT(FP16, I32), MKLDNN_CVT(FP16, U64), MKLDNN_CVT(FP16, I64), \
|
||||
MKLDNN_CVT(FP16, FP32), MKLDNN_CVT(FP16, BF16), MKLDNN_CVT(FP16, FP64), MKLDNN_CVT(FP16, BOOL), \
|
||||
MKLDNN_CVT(BF16, U8), MKLDNN_CVT(BF16, I8), MKLDNN_CVT(BF16, U16), MKLDNN_CVT(BF16, I16), \
|
||||
MKLDNN_CVT(BF16, U32), MKLDNN_CVT(BF16, I32), MKLDNN_CVT(BF16, U64), MKLDNN_CVT(BF16, I64), \
|
||||
MKLDNN_CVT(BF16, FP32), MKLDNN_CVT(BF16, FP16), MKLDNN_CVT(BF16, FP64), MKLDNN_CVT(BF16, BOOL), \
|
||||
MKLDNN_CVT(FP64, U8), MKLDNN_CVT(FP64, I8), MKLDNN_CVT(FP64, U16), MKLDNN_CVT(FP64, I16), \
|
||||
MKLDNN_CVT(FP64, U32), MKLDNN_CVT(FP64, I32), MKLDNN_CVT(FP64, U64), MKLDNN_CVT(FP64, I64), \
|
||||
MKLDNN_CVT(FP64, FP32), MKLDNN_CVT(FP64, FP16), MKLDNN_CVT(FP64, BF16), MKLDNN_CVT(FP64, BOOL), \
|
||||
MKLDNN_CVT(BOOL, U8), MKLDNN_CVT(BOOL, I8), MKLDNN_CVT(BOOL, U16), MKLDNN_CVT(BOOL, I16), \
|
||||
MKLDNN_CVT(BOOL, U32), MKLDNN_CVT(BOOL, I32), MKLDNN_CVT(BOOL, U64), MKLDNN_CVT(BOOL, I64), \
|
||||
MKLDNN_CVT(BOOL, FP32), MKLDNN_CVT(BOOL, FP16), MKLDNN_CVT(BOOL, BF16), MKLDNN_CVT(BOOL, FP64), \
|
||||
MKLDNN_CVT(U8, U8), MKLDNN_CVT(I8, I8), MKLDNN_CVT(U16, U16), MKLDNN_CVT(I16, I16), \
|
||||
MKLDNN_CVT(U32, U32), MKLDNN_CVT(I32, I32), MKLDNN_CVT(U64, U64), MKLDNN_CVT(I64, I64), \
|
||||
MKLDNN_CVT(FP32, FP32), MKLDNN_CVT(FP16, FP16), MKLDNN_CVT(BF16, BF16), MKLDNN_CVT(FP64, FP64), \
|
||||
MKLDNN_CVT(BOOL, BOOL)
|
||||
|
||||
void cpu_convert(const void *srcPtr, void *dstPtr, Precision srcPrc, Precision dstPrc, const size_t size) {
|
||||
cpu_convert(srcPtr, dstPtr, srcPrc, dstPrc, dstPrc, size);
|
||||
}
|
||||
|
||||
void cpu_convert(const void *srcPtr,
|
||||
void *dstPtr,
|
||||
InferenceEngine::Precision srcPrc,
|
||||
InferenceEngine::Precision interimPrc,
|
||||
InferenceEngine::Precision dstPrc,
|
||||
const size_t size) {
|
||||
if (srcPtr == nullptr || dstPtr == nullptr)
|
||||
IE_THROW() << "cpu_convert has null data pointer";
|
||||
|
||||
if (srcPrc == dstPrc) {
|
||||
cpu_memcpy(dstPtr, srcPtr, size*dstPrc.size());
|
||||
return;
|
||||
if (srcPrc == dstPrc && srcPrc == interimPrc) {
|
||||
cpu_memcpy(dstPtr, srcPtr, size * dstPrc.size());
|
||||
} else {
|
||||
ConvertContext ctx = {
|
||||
srcPtr,
|
||||
dstPtr,
|
||||
size,
|
||||
interimPrc,
|
||||
dstPrc,
|
||||
false
|
||||
};
|
||||
OV_SWITCH(MKLDNNPlugin, ConvertPrecision, ctx, std::tie(srcPrc, dstPrc), MKLDNN_CVT_LIST);
|
||||
if (!ctx.converted)
|
||||
IE_THROW() << "cpu_convert can't convert from: " << srcPrc << " precision to: " << dstPrc;
|
||||
}
|
||||
|
||||
ConvertContext ctx = { srcPtr, dstPtr, size, false };
|
||||
|
||||
OV_SWITCH(MKLDNNPlugin, ConvertPrecision, ctx, std::tie(srcPrc, dstPrc),
|
||||
MKLDNN_CVT(U8, I8), MKLDNN_CVT(U8, U16), MKLDNN_CVT(U8, I16),
|
||||
MKLDNN_CVT(U8, I32), MKLDNN_CVT(U8, U64), MKLDNN_CVT(U8, I64),
|
||||
MKLDNN_CVT(U8, FP32), MKLDNN_CVT(U8, BF16), MKLDNN_CVT(U8, BOOL),
|
||||
MKLDNN_CVT(I8, U8), MKLDNN_CVT(I8, U16), MKLDNN_CVT(I8, I16),
|
||||
MKLDNN_CVT(I8, I32), MKLDNN_CVT(I8, U64), MKLDNN_CVT(I8, I64),
|
||||
MKLDNN_CVT(I8, FP32), MKLDNN_CVT(I8, BF16), MKLDNN_CVT(I8, BOOL),
|
||||
MKLDNN_CVT(U16, U8), MKLDNN_CVT(U16, I8), MKLDNN_CVT(U16, I16),
|
||||
MKLDNN_CVT(U16, I32), MKLDNN_CVT(U16, U64), MKLDNN_CVT(U16, I64),
|
||||
MKLDNN_CVT(U16, FP32), MKLDNN_CVT(U16, BF16), MKLDNN_CVT(U16, BOOL),
|
||||
MKLDNN_CVT(I16, U8), MKLDNN_CVT(I16, I8), MKLDNN_CVT(I16, U16),
|
||||
MKLDNN_CVT(I16, I32), MKLDNN_CVT(I16, U64), MKLDNN_CVT(I16, I64),
|
||||
MKLDNN_CVT(I16, FP32), MKLDNN_CVT(I16, BF16), MKLDNN_CVT(I16, BOOL),
|
||||
MKLDNN_CVT(I32, U8), MKLDNN_CVT(I32, I8), MKLDNN_CVT(I32, U16),
|
||||
MKLDNN_CVT(I32, I16), MKLDNN_CVT(I32, U64), MKLDNN_CVT(I32, I64),
|
||||
MKLDNN_CVT(I32, FP32), MKLDNN_CVT(I32, BF16), MKLDNN_CVT(I32, BOOL),
|
||||
MKLDNN_CVT(U64, U8), MKLDNN_CVT(U64, I8), MKLDNN_CVT(U64, U16),
|
||||
MKLDNN_CVT(U64, I16), MKLDNN_CVT(U64, I32), MKLDNN_CVT(U64, I64),
|
||||
MKLDNN_CVT(U64, FP32), MKLDNN_CVT(U64, BF16), MKLDNN_CVT(U64, BOOL),
|
||||
MKLDNN_CVT(I64, U8), MKLDNN_CVT(I64, I8), MKLDNN_CVT(I64, U16),
|
||||
MKLDNN_CVT(I64, I16), MKLDNN_CVT(I64, I32), MKLDNN_CVT(I64, U64),
|
||||
MKLDNN_CVT(I64, FP32), MKLDNN_CVT(I64, BF16), MKLDNN_CVT(I64, BOOL),
|
||||
MKLDNN_CVT(FP32, U8), MKLDNN_CVT(FP32, I8), MKLDNN_CVT(FP32, U16),
|
||||
MKLDNN_CVT(FP32, I16), MKLDNN_CVT(FP32, I32), MKLDNN_CVT(FP32, U64),
|
||||
MKLDNN_CVT(FP32, I64), MKLDNN_CVT(FP32, BF16), MKLDNN_CVT(FP32, BOOL),
|
||||
MKLDNN_CVT(BF16, U8), MKLDNN_CVT(BF16, I8), MKLDNN_CVT(BF16, U16),
|
||||
MKLDNN_CVT(BF16, I16), MKLDNN_CVT(BF16, I32), MKLDNN_CVT(BF16, U64),
|
||||
MKLDNN_CVT(BF16, I64), MKLDNN_CVT(BF16, FP32), MKLDNN_CVT(BF16, BOOL),
|
||||
MKLDNN_CVT(BOOL, U8), MKLDNN_CVT(BOOL, I8), MKLDNN_CVT(BOOL, U16),
|
||||
MKLDNN_CVT(BOOL, I16), MKLDNN_CVT(BOOL, I32), MKLDNN_CVT(BOOL, U64),
|
||||
MKLDNN_CVT(BOOL, I64), MKLDNN_CVT(BOOL, FP32), MKLDNN_CVT(BOOL, BF16),
|
||||
MKLDNN_CVT(FP64, U8), MKLDNN_CVT(FP64, I8), MKLDNN_CVT(FP64, U16),
|
||||
MKLDNN_CVT(FP64, I16), MKLDNN_CVT(FP64, I32), MKLDNN_CVT(FP64, U64),
|
||||
MKLDNN_CVT(FP64, I64), MKLDNN_CVT(FP64, FP32), MKLDNN_CVT(FP64, BF16), MKLDNN_CVT(FP64, BOOL),
|
||||
MKLDNN_CVT(U32, U8), MKLDNN_CVT(U32, I8), MKLDNN_CVT(U32, U16),
|
||||
MKLDNN_CVT(U32, I16), MKLDNN_CVT(U32, I32), MKLDNN_CVT(U32, U64),
|
||||
MKLDNN_CVT(U32, I64), MKLDNN_CVT(U32, FP32), MKLDNN_CVT(U32, BF16), MKLDNN_CVT(U32, BOOL));
|
||||
|
||||
if (!ctx.converted)
|
||||
IE_THROW() << "cpu_convert can't convert from: " << srcPrc << " precision to: " << dstPrc;
|
||||
}
|
||||
|
||||
#undef MKLDNN_CVT
|
||||
#undef MKLDNN_CVT_LIST
|
||||
@@ -19,5 +19,32 @@
|
||||
* number of elements in buffers to be converted
|
||||
* @return none.
|
||||
*/
|
||||
void cpu_convert(const void *srcPtr,
|
||||
void *dstPtr,
|
||||
InferenceEngine::Precision srcPrc,
|
||||
InferenceEngine::Precision dstPrc,
|
||||
const size_t size);
|
||||
|
||||
void cpu_convert(const void *srcPtr, void *dstPtr, InferenceEngine::Precision srcPrc, InferenceEngine::Precision dstPrc, const size_t size);
|
||||
/**
|
||||
* @brief Copy size elements from buffer specified srcPtr pointer to buffer specified dstPtr.
|
||||
* If the precisions srcPrc and dstPrc are different, a conversion from srcPrc to dstPrc is performed.
|
||||
* @param srcPtr
|
||||
* pointer to the buffer to convert from
|
||||
* @param dstPtr
|
||||
* pointer to the buffer to convert to
|
||||
* @param srcPrc
|
||||
* precision the buffer from which convert
|
||||
* @param interimPrc
|
||||
* intermediate precision used for type truncation
|
||||
* @param dstPrc
|
||||
* precision the buffer to which convert
|
||||
* @param size
|
||||
* number of elements in buffers to be converted
|
||||
* @return none.
|
||||
*/
|
||||
void cpu_convert(const void *srcPtr,
|
||||
void *dstPtr,
|
||||
InferenceEngine::Precision srcPrc,
|
||||
InferenceEngine::Precision interimPrc,
|
||||
InferenceEngine::Precision dstPrc,
|
||||
const size_t size);
|
||||
@@ -7,7 +7,8 @@
|
||||
#include "common/cpu_convert.h"
|
||||
#include "common/blocked_desc_creator.h"
|
||||
#include <ngraph/opsets/opset1.hpp>
|
||||
#include "utils/ngraph_utils.hpp"
|
||||
#include <ie_ngraph_utils.hpp>
|
||||
#include <utils/ngraph_utils.hpp>
|
||||
|
||||
using namespace mkldnn;
|
||||
using namespace MKLDNNPlugin;
|
||||
@@ -26,14 +27,17 @@ bool MKLDNNConvertNode::isSupportedOperation(const std::shared_ptr<const ngraph:
|
||||
return true;
|
||||
}
|
||||
|
||||
MKLDNNConvertNode::MKLDNNConvertNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache) :
|
||||
MKLDNNNode(op, eng, cache) {
|
||||
MKLDNNConvertNode::MKLDNNConvertNode(const std::shared_ptr<ngraph::Node>& op, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache)
|
||||
: MKLDNNNode(op, eng, cache) {
|
||||
std::string errorMessage;
|
||||
if (isSupportedOperation(op, errorMessage)) {
|
||||
errorPrefix = "Convert node with name '" + getName() + "'";
|
||||
} else {
|
||||
IE_THROW(NotImplemented) << errorMessage;
|
||||
}
|
||||
|
||||
auto convert = ov::as_type_ptr<const ngraph::opset1::Convert>(op);
|
||||
origPrc = details::convertPrecision(convert->get_destination_type());
|
||||
}
|
||||
|
||||
std::vector<VectorDims> MKLDNNConvertNode::shapeInfer() const {
|
||||
@@ -42,7 +46,8 @@ std::vector<VectorDims> MKLDNNConvertNode::shapeInfer() const {
|
||||
|
||||
MKLDNNConvertNode::MKLDNNConvertNode(const Shape &shape, const InferenceEngine::Precision &inPrc, const InferenceEngine::Precision &outPrc,
|
||||
const std::string &nodeName, const mkldnn::engine& eng, MKLDNNWeightsSharing::Ptr &cache)
|
||||
: MKLDNNNode("Convert", nodeName, eng, cache) {
|
||||
: MKLDNNNode("Convert", nodeName, eng, cache)
|
||||
, origPrc(outPrc) {
|
||||
inputShapes.push_back(shape);
|
||||
addOriginalInputPrecision(inPrc);
|
||||
outputShapes.push_back(shape);
|
||||
@@ -147,7 +152,13 @@ void MKLDNNConvertNode::execute(mkldnn::stream strm) {
|
||||
|
||||
void* srcPtr = parentMem.GetPtr();
|
||||
void* dstPtr = childMem.GetPtr();
|
||||
cpu_convert(srcPtr, dstPtr, parentMem.getDesc().getPrecision(), childMem.getDesc().getPrecision(), parentPaddElemCount);
|
||||
|
||||
cpu_convert(srcPtr,
|
||||
dstPtr,
|
||||
parentMem.getDesc().getPrecision(),
|
||||
origPrc,
|
||||
childMem.getDesc().getPrecision(),
|
||||
parentPaddElemCount);
|
||||
}
|
||||
|
||||
bool MKLDNNConvertNode::created() const {
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
private:
|
||||
MemoryDescPtr input;
|
||||
MemoryDescPtr output;
|
||||
InferenceEngine::Precision origPrc;
|
||||
|
||||
std::string errorPrefix;
|
||||
};
|
||||
|
||||
@@ -101,16 +101,9 @@ tests_expected_to_fail = [
|
||||
(
|
||||
xfail_issue_FLOAT_LIKE,
|
||||
"OnnxBackendNodeModelTest.test_cast_BFLOAT16_to_FLOAT_cpu",
|
||||
"OnnxBackendNodeModelTest.test_cast_FLOAT16_to_DOUBLE_cpu",
|
||||
"OnnxBackendNodeModelTest.test_cast_FLOAT16_to_FLOAT_cpu",
|
||||
"OnnxBackendNodeModelTest.test_cast_FLOAT_to_BFLOAT16_cpu",
|
||||
"OnnxBackendNodeModelTest.test_castlike_BFLOAT16_to_FLOAT_expanded_cpu",
|
||||
"OnnxBackendNodeModelTest.test_castlike_FLOAT16_to_DOUBLE_expanded_cpu",
|
||||
"OnnxBackendNodeModelTest.test_castlike_FLOAT16_to_FLOAT_expanded_cpu",
|
||||
"OnnxBackendNodeModelTest.test_castlike_FLOAT_to_BFLOAT16_expanded_cpu",
|
||||
"OnnxBackendNodeModelTest.test_max_float16_cpu",
|
||||
"OnnxBackendNodeModelTest.test_min_float16_cpu",
|
||||
"OnnxBackendNodeModelTest.test_mod_mixed_sign_float16_cpu",
|
||||
),
|
||||
(
|
||||
xfail_issue_49207,
|
||||
|
||||
@@ -171,12 +171,6 @@ if len(zoo_models) > 0:
|
||||
test_cases = backend_test.test_cases["OnnxBackendModelExecutionTest"]
|
||||
if tests.MODEL_ZOO_XFAIL:
|
||||
execution_xfail_list = [
|
||||
# New Python API - fp16 blob
|
||||
(xfail_issue_67415, "test_MSFT_opset7_fp16_inception_v1_onnxzoo_lotus_inception_v1_cpu"),
|
||||
(xfail_issue_67415, "test_MSFT_opset7_fp16_shufflenet_onnxzoo_lotus_shufflenet_cpu"),
|
||||
(xfail_issue_67415, "test_MSFT_opset8_fp16_inception_v1_onnxzoo_lotus_inception_v1_cpu"),
|
||||
(xfail_issue_67415, "test_MSFT_opset8_fp16_shufflenet_onnxzoo_lotus_shufflenet_cpu"),
|
||||
|
||||
# ONNX Model Zoo
|
||||
(xfail_issue_39669, "test_onnx_model_zoo_text_machine_comprehension_t5_model_t5_encoder_12_t5_encoder_cpu"),
|
||||
(xfail_issue_39669, "test_onnx_model_zoo_text_machine_comprehension_t5_model_t5_decoder_with_lm_head_12_t5_decoder_with_lm_head_cpu"),
|
||||
|
||||
@@ -309,16 +309,15 @@ void IInferencePlugin::SetExeNetworkInfo(const std::shared_ptr<IExecutableNetwor
|
||||
OPENVINO_ASSERT(outputsInfo.size() == function->get_output_size());
|
||||
|
||||
for (const auto& param : function->get_parameters()) {
|
||||
auto new_param = param->copy_with_new_inputs({});
|
||||
auto new_param = ov::as_type_ptr<ov::op::v0::Parameter>(param->copy_with_new_inputs({}));
|
||||
new_param->set_friendly_name(param->get_friendly_name());
|
||||
if (add_operation_names)
|
||||
new_param->output(0).get_tensor().add_names({new_param->get_friendly_name()});
|
||||
// WA: use CNNNetwork's precisions since plugins sometimes override their precisions
|
||||
// after transformation pipeline is run
|
||||
new_param->set_output_type(
|
||||
0,
|
||||
InferenceEngine::details::convertPrecision(inputsInfo.at(new_param->get_friendly_name())->getPrecision()),
|
||||
new_param->get_output_partial_shape(0));
|
||||
new_param->set_element_type(
|
||||
InferenceEngine::details::convertPrecision(inputsInfo.at(new_param->get_friendly_name())->getPrecision()));
|
||||
new_param->validate_and_infer_types();
|
||||
const_params.emplace_back(new_param);
|
||||
}
|
||||
for (const auto& result : function->get_results()) {
|
||||
@@ -326,10 +325,9 @@ void IInferencePlugin::SetExeNetworkInfo(const std::shared_ptr<IExecutableNetwor
|
||||
result->get_output_partial_shape(0));
|
||||
const std::string param_name = ngraph::op::util::create_ie_output_name(result->input_value(0));
|
||||
fake_param->set_friendly_name(param_name);
|
||||
fake_param->set_output_type(
|
||||
0,
|
||||
InferenceEngine::details::convertPrecision(outputsInfo.at(param_name)->getPrecision()),
|
||||
fake_param->get_output_partial_shape(0));
|
||||
fake_param->set_element_type(
|
||||
InferenceEngine::details::convertPrecision(outputsInfo.at(param_name)->getPrecision()));
|
||||
fake_param->validate_and_infer_types();
|
||||
auto new_result = result->copy_with_new_inputs({fake_param});
|
||||
new_result->set_friendly_name(result->get_friendly_name());
|
||||
if (add_operation_names) {
|
||||
|
||||
@@ -8,8 +8,15 @@
|
||||
using namespace BehaviorTestsDefinitions;
|
||||
using namespace InferenceEngine;
|
||||
|
||||
const std::vector<Precision> precisionSet = {Precision::FP32, Precision::I16, Precision::U8, Precision::I8, Precision::U16, Precision::I32, Precision::BOOL,
|
||||
Precision::I64, Precision::U64};
|
||||
const std::vector<Precision> precisionSet = {
|
||||
Precision::U8, Precision::I8,
|
||||
Precision::U16, Precision::I16,
|
||||
Precision::U32, Precision::I32,
|
||||
Precision::U64, Precision::I64,
|
||||
Precision::BF16, Precision::FP16,
|
||||
Precision::FP32, Precision::FP64,
|
||||
Precision::BOOL
|
||||
};
|
||||
|
||||
const std::vector<setType> typeSet = {setType::INPUT, setType::OUTPUT, setType::BOTH};
|
||||
|
||||
|
||||
+15
-13
@@ -18,24 +18,26 @@ const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
|
||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
||||
|
||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||
// Ticket: 59594
|
||||
// InferenceEngine::Precision::I4,
|
||||
InferenceEngine::Precision::I8,
|
||||
InferenceEngine::Precision::I16,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::I64,
|
||||
// Ticket: 59594
|
||||
// InferenceEngine::Precision::BIN,
|
||||
// InferenceEngine::Precision::BOOL,
|
||||
// InferenceEngine::Precision::U4,
|
||||
InferenceEngine::Precision::U8,
|
||||
InferenceEngine::Precision::I8,
|
||||
InferenceEngine::Precision::U16,
|
||||
// Ticket: 59594
|
||||
// InferenceEngine::Precision::U32,
|
||||
InferenceEngine::Precision::I16,
|
||||
InferenceEngine::Precision::U32,
|
||||
InferenceEngine::Precision::I32,
|
||||
InferenceEngine::Precision::U64,
|
||||
InferenceEngine::Precision::I64,
|
||||
InferenceEngine::Precision::BF16,
|
||||
InferenceEngine::Precision::FP16,
|
||||
InferenceEngine::Precision::FP32};
|
||||
InferenceEngine::Precision::FP32,
|
||||
InferenceEngine::Precision::FP64,
|
||||
InferenceEngine::Precision::BOOL,
|
||||
InferenceEngine::Precision::MIXED,
|
||||
InferenceEngine::Precision::Q78,
|
||||
InferenceEngine::Precision::U4,
|
||||
InferenceEngine::Precision::I4,
|
||||
InferenceEngine::Precision::BIN,
|
||||
InferenceEngine::Precision::CUSTOM,
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(smoke_ConversionLayerTest,
|
||||
ConversionLayerTest,
|
||||
|
||||
@@ -104,17 +104,6 @@ std::vector<std::string> disabledTestPatterns() {
|
||||
|
||||
// CPU plugin does not support some precisions
|
||||
R"(smoke_CachingSupportCase_CPU/LoadNetworkCacheTestBase.CompareWithRefImpl/ReadConcatSplitAssign_f32_batch1_CPU)",
|
||||
// CPU plugin does not support some precisions
|
||||
R"(.*Behavior.*OVExecGraphImportExportTest.*elementType=(i8|u32).*)",
|
||||
R"(.*Behavior.*OVExecGraphImportExportTest.*elementType=(f16).*)",
|
||||
R"(.*EltwiseLayerTest.*NetType=f16.*)",
|
||||
|
||||
// TODO: CVS-66526 overrides i/o precisions in execution graph
|
||||
// as WA we used GetInputsInfo() precisions instead of ngraph ones
|
||||
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedFunction.*type=(i16|u16).*)",
|
||||
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedFunction.*type=(i64|u64).*)",
|
||||
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedIENetwork.*type=(i16|u16).*)",
|
||||
// R"(.*smoke_BehaviorTests.*OVExecGraphImportExportTest.*importExportedIENetwork.*type=(i64|u64).*)",
|
||||
|
||||
// CPU does not support dynamic rank
|
||||
// Issue: CVS-66778
|
||||
@@ -168,7 +157,18 @@ std::vector<std::string> disabledTestPatterns() {
|
||||
R"(.*CTCLossLayerCPUTest.*ctcMergeRepeated=1.*)",
|
||||
// Issue: 71756
|
||||
R"(.*Deconv_.*D_(Blocked|DW|1x1)_.*DeconvolutionLayerCPUTest\.CompareWithRefs.*inFmts=(nChw16c|nCdhw16c)_outFmts=(nChw16c|nCdhw16c)_primitive=jit_avx512_.*Fused=Multiply\(PerChannel\)\.Add\(PerChannel\).*)",
|
||||
R"(.*smoke_GroupDeconv_(2|3)D_Blocked_BF16.*S=(\(2\.2\)|\(2\.2\.2\))_PB=(\(0\.0\)|\(0\.0\.0\))_PE=(\(0\.0\)|\(0\.0\.0\))_D=(\(1\.1\)|\(1\.1\.1\))_.*_O=64_G=4.*)"
|
||||
R"(.*smoke_GroupDeconv_(2|3)D_Blocked_BF16.*S=(\(2\.2\)|\(2\.2\.2\))_PB=(\(0\.0\)|\(0\.0\.0\))_PE=(\(0\.0\)|\(0\.0\.0\))_D=(\(1\.1\)|\(1\.1\.1\))_.*_O=64_G=4.*)",
|
||||
// Issue: 72150
|
||||
R"(.*smoke_SetBlobCPU/SetBlobTest.CompareWithRefs/Type=.*_Device=CPU_PrecisionInNet=BOOL.*)",
|
||||
// Issue: 59594
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*BOOL.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*MIXED.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*Q78.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*U4.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*I4.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*BIN.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*CUSTOM.*)",
|
||||
R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*UNSPECIFIED.*)",
|
||||
};
|
||||
|
||||
#define FIX_62820 0
|
||||
|
||||
+8
@@ -108,11 +108,15 @@ TEST_P(OVExecGraphImportExportTest, importExportedFunction) {
|
||||
importedExecNet.input(0).get_tensor().get_partial_shape());
|
||||
EXPECT_EQ(function->input(0).get_tensor().get_element_type(),
|
||||
importedExecNet.input(0).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->input(0).get_element_type(),
|
||||
importedExecNet.input(0).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->input(1).get_tensor().get_names(), importedExecNet.input(1).get_tensor().get_names());
|
||||
EXPECT_EQ(function->input(1).get_tensor().get_partial_shape(),
|
||||
importedExecNet.input(1).get_tensor().get_partial_shape());
|
||||
EXPECT_EQ(function->input(1).get_tensor().get_element_type(),
|
||||
importedExecNet.input(1).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->input(1).get_element_type(),
|
||||
importedExecNet.input(1).get_tensor().get_element_type());
|
||||
EXPECT_EQ(importedExecNet.input(0).get_node(), importedExecNet.input("data1").get_node());
|
||||
EXPECT_NE(importedExecNet.input(1).get_node(), importedExecNet.input("data1").get_node());
|
||||
EXPECT_EQ(importedExecNet.input(1).get_node(), importedExecNet.input("data2").get_node());
|
||||
@@ -125,11 +129,15 @@ TEST_P(OVExecGraphImportExportTest, importExportedFunction) {
|
||||
importedExecNet.output(0).get_tensor().get_partial_shape());
|
||||
EXPECT_EQ(function->output(0).get_tensor().get_element_type(),
|
||||
importedExecNet.output(0).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->output(0).get_element_type(),
|
||||
importedExecNet.output(0).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->output(1).get_tensor().get_names(), importedExecNet.output(1).get_tensor().get_names());
|
||||
EXPECT_EQ(function->output(1).get_tensor().get_partial_shape(),
|
||||
importedExecNet.output(1).get_tensor().get_partial_shape());
|
||||
EXPECT_EQ(function->output(1).get_tensor().get_element_type(),
|
||||
importedExecNet.output(1).get_tensor().get_element_type());
|
||||
EXPECT_EQ(function->output(1).get_element_type(),
|
||||
importedExecNet.output(1).get_tensor().get_element_type());
|
||||
EXPECT_EQ(importedExecNet.output(0).get_node(), importedExecNet.output("relu").get_node());
|
||||
EXPECT_NE(importedExecNet.output(1).get_node(), importedExecNet.output("relu").get_node());
|
||||
EXPECT_EQ(importedExecNet.output(1).get_node(), importedExecNet.output("concat").get_node());
|
||||
|
||||
@@ -43,15 +43,19 @@ std::string SetBlobTest::getTestCaseName(testing::TestParamInfo<SetBlobParams> o
|
||||
inline void fillBlob(Blob::Ptr &blob) {
|
||||
switch (blob->getTensorDesc().getPrecision()) {
|
||||
#define CASE(X) case X: CommonTestUtils::fill_data_random<X>(blob); break;
|
||||
CASE(InferenceEngine::Precision::FP32)
|
||||
CASE(InferenceEngine::Precision::U8)
|
||||
CASE(InferenceEngine::Precision::U16)
|
||||
CASE(InferenceEngine::Precision::I8)
|
||||
CASE(InferenceEngine::Precision::I16)
|
||||
CASE(InferenceEngine::Precision::I64)
|
||||
CASE(InferenceEngine::Precision::U64)
|
||||
CASE(InferenceEngine::Precision::I32)
|
||||
CASE(InferenceEngine::Precision::BOOL)
|
||||
CASE(Precision::U8)
|
||||
CASE(Precision::I8)
|
||||
CASE(Precision::U16)
|
||||
CASE(Precision::I16)
|
||||
CASE(Precision::U32)
|
||||
CASE(Precision::I32)
|
||||
CASE(Precision::U64)
|
||||
CASE(Precision::I64)
|
||||
CASE(Precision::BF16)
|
||||
CASE(Precision::FP16)
|
||||
CASE(Precision::FP32)
|
||||
CASE(Precision::FP64)
|
||||
CASE(Precision::BOOL)
|
||||
#undef CASE
|
||||
default:
|
||||
IE_THROW() << "Can't fill blob with precision: " << blob->getTensorDesc().getPrecision();
|
||||
|
||||
@@ -131,54 +131,54 @@ inline void callCompare(const std::pair<ngraph::element::Type, std::vector<std::
|
||||
const T_IE* actualBuffer, size_t size, float threshold, float abs_threshold) {
|
||||
auto expectedBuffer = expected.second.data();
|
||||
switch (expected.first) {
|
||||
case ngraph::element::Type_t::i64:
|
||||
LayerTestsCommon::Compare<T_IE, int64_t>(reinterpret_cast<const int64_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::i32:
|
||||
LayerTestsCommon::Compare<T_IE, int32_t>(reinterpret_cast<const int32_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::i16:
|
||||
LayerTestsCommon::Compare<T_IE, int16_t>(reinterpret_cast<const int16_t *>(expectedBuffer),
|
||||
case ngraph::element::Type_t::boolean:
|
||||
case ngraph::element::Type_t::u8:
|
||||
LayerTestsCommon::Compare<T_IE, uint8_t>(reinterpret_cast<const uint8_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::i8:
|
||||
LayerTestsCommon::Compare<T_IE, int8_t>(reinterpret_cast<const int8_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::u64:
|
||||
LayerTestsCommon::Compare<T_IE, uint64_t>(reinterpret_cast<const uint64_t *>(expectedBuffer),
|
||||
case ngraph::element::Type_t::u16:
|
||||
LayerTestsCommon::Compare<T_IE, uint16_t>(reinterpret_cast<const uint16_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::i16:
|
||||
LayerTestsCommon::Compare<T_IE, int16_t>(reinterpret_cast<const int16_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::u32:
|
||||
LayerTestsCommon::Compare<T_IE, uint32_t>(reinterpret_cast<const uint32_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::u16:
|
||||
LayerTestsCommon::Compare<T_IE, uint16_t>(reinterpret_cast<const uint16_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::boolean:
|
||||
case ngraph::element::Type_t::u8:
|
||||
LayerTestsCommon::Compare<T_IE, uint8_t>(reinterpret_cast<const uint8_t *>(expectedBuffer),
|
||||
case ngraph::element::Type_t::i32:
|
||||
LayerTestsCommon::Compare<T_IE, int32_t>(reinterpret_cast<const int32_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::f64:
|
||||
LayerTestsCommon::Compare<T_IE, double>(reinterpret_cast<const double *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
case ngraph::element::Type_t::u64:
|
||||
LayerTestsCommon::Compare<T_IE, uint64_t>(reinterpret_cast<const uint64_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::f32:
|
||||
LayerTestsCommon::Compare<T_IE, float>(reinterpret_cast<const float *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
case ngraph::element::Type_t::i64:
|
||||
LayerTestsCommon::Compare<T_IE, int64_t>(reinterpret_cast<const int64_t *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::bf16:
|
||||
LayerTestsCommon::Compare<T_IE, ngraph::bfloat16>(reinterpret_cast<const ngraph::bfloat16 *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::f16:
|
||||
LayerTestsCommon::Compare<T_IE, ngraph::float16>(reinterpret_cast<const ngraph::float16 *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::bf16:
|
||||
LayerTestsCommon::Compare<T_IE, ngraph::bfloat16>(reinterpret_cast<const ngraph::bfloat16 *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
case ngraph::element::Type_t::f32:
|
||||
LayerTestsCommon::Compare<T_IE, float>(reinterpret_cast<const float *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::f64:
|
||||
LayerTestsCommon::Compare<T_IE, double>(reinterpret_cast<const double *>(expectedBuffer),
|
||||
actualBuffer, size, threshold, abs_threshold);
|
||||
break;
|
||||
case ngraph::element::Type_t::i4: {
|
||||
auto expectedOut = ngraph::helpers::convertOutputPrecision(
|
||||
@@ -230,14 +230,9 @@ void LayerTestsCommon::Compare(const std::pair<ngraph::element::Type, std::vecto
|
||||
|
||||
const auto &size = actual->size();
|
||||
switch (precision) {
|
||||
case InferenceEngine::Precision::FP32:
|
||||
callCompare<float>(expected, reinterpret_cast<const float *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::I32:
|
||||
callCompare<int32_t>(expected, reinterpret_cast<const int32_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::I64:
|
||||
callCompare<int64_t>(expected, reinterpret_cast<const int64_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
case InferenceEngine::Precision::BOOL:
|
||||
case InferenceEngine::Precision::U8:
|
||||
callCompare<uint8_t>(expected, reinterpret_cast<const uint8_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::I8:
|
||||
callCompare<int8_t>(expected, reinterpret_cast<const int8_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
@@ -248,19 +243,30 @@ void LayerTestsCommon::Compare(const std::pair<ngraph::element::Type, std::vecto
|
||||
case InferenceEngine::Precision::I16:
|
||||
callCompare<int16_t>(expected, reinterpret_cast<const int16_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::BOOL:
|
||||
case InferenceEngine::Precision::U8:
|
||||
callCompare<uint8_t>(expected, reinterpret_cast<const uint8_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
case InferenceEngine::Precision::U32:
|
||||
callCompare<uint32_t>(expected, reinterpret_cast<const uint32_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::I32:
|
||||
callCompare<int32_t>(expected, reinterpret_cast<const int32_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::U64:
|
||||
callCompare<uint64_t>(expected, reinterpret_cast<const uint64_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::I64:
|
||||
callCompare<int64_t>(expected, reinterpret_cast<const int64_t *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::BF16:
|
||||
callCompare<ngraph::bfloat16>(expected, reinterpret_cast<const ngraph::bfloat16 *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::FP16:
|
||||
callCompare<ngraph::float16>(expected, reinterpret_cast<const ngraph::float16 *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::FP32:
|
||||
callCompare<float>(expected, reinterpret_cast<const float *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
case InferenceEngine::Precision::FP64:
|
||||
callCompare<double>(expected, reinterpret_cast<const double *>(actualBuffer), size, threshold, abs_threshold);
|
||||
break;
|
||||
default:
|
||||
FAIL() << "Comparator for " << precision << " precision isn't supported";
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ std::string ConversionLayerTest::getTestCaseName(const testing::TestParamInfo<Co
|
||||
}
|
||||
|
||||
void ConversionLayerTest::SetUp() {
|
||||
if (FuncTestUtils::SkipTestsConfig::currentTestIsDisabled()) {
|
||||
GTEST_SKIP() << "Disabled test due to configuration" << std::endl;
|
||||
}
|
||||
ngraph::helpers::ConversionTypes conversionOpType;
|
||||
InferenceEngine::Precision inputPrecision, targetPrecision;
|
||||
std::vector<std::vector<size_t>> inputShape;
|
||||
|
||||
Reference in new issue
Block a user