[CPU] RNN layer. Blobs precision validation. (#2223)

This commit is contained in:
Nikolay Shchegolev authored and GitHub committed 2020-09-16 18:19:14 +03:00
1 parent 1e5edf86a1
commit 5e4377b250
1 file changed
+10
@@ -332,6 +332,16 @@ void MKLDNNRNN::createDescriptor(const std::vector<TensorDesc> &inputDesc,
void MKLDNNRNN::createPrimitive() {
if (prim) return;
std::string errorPrefix = "RNN layer '" + getCnnLayer()->name + "'";
auto weightsIt = getCnnLayer()->blobs.find("weights");
if (weightsIt == getCnnLayer()->blobs.end())
THROW_IE_EXCEPTION << errorPrefix << " does not have weights blob.";
if (weightsIt->second->getTensorDesc().getPrecision() != Precision::FP32)
THROW_IE_EXCEPTION << errorPrefix << " has invalid weights precision: " << weightsIt->second->getTensorDesc().getPrecision();
if (getCnnLayer()->blobs.find("biases") != getCnnLayer()->blobs.end()
&& getCnnLayer()->blobs["biases"]->getTensorDesc().getPrecision() != Precision::FP32)
THROW_IE_EXCEPTION << errorPrefix << " has invalid biases precision: " << getCnnLayer()->blobs["biases"]->getTensorDesc().getPrecision();
std::shared_ptr<rnn_forward::desc> d = descs[0];
rnn_forward::primitive_desc pd(*d, getEngine());