Hi all,
I made a simple sample. Conv an 8x8 image with a 4x4 kernel.
int main(int argc, const char *argv[]){
// test
torch::Tensor img = torch::ones({ 1,1,8,8 }, torch::TensorOptions(torch::kFloat).device(torch::kCPU));
float* pimg = (float*)img.data_ptr();
for (int i = 0; i < 64; i++)
{
pimg[i] = (float)i;
}
torch::nn::Conv2d conv(torch::nn::Conv2dOptions(1, 1, 4).padding(1).stride(2));
conv->to(torch::kCPU);
torch::Tensor weights = conv->weight;
float* data = (float*)weights.data_ptr();
for (int i = 0; i < 16; i++)
{
data[i] = 1.0;
}
torch::Tensor bias = conv->bias;
data = (float*)bias.data_ptr();
data[0] = 0.0;
torch::Tensor output = conv->forward(img);
The sample fails at conv->forward with
Assertion failed: nthr_ == nthr, file C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\third_party\ideep\mkl-dnn\src\common/dnnl_thread.hpp, line 308
What is wrong with the simple sample?
Many thanks for your help.