I am trying to apply de deconvolution operations using C++ but I get runtime errors when trying to something as simple as
#include <chrono>
#include "mxnet-cpp/MxNetCpp.h"
using namespace std;
using namespace mxnet::cpp;
Symbol create_generator()
{
auto input = Symbol::Variable("x");
auto d1 = Deconvolution(
input,
Symbol::Variable("w0"),
Symbol::Variable("c0"), //bias
Shape(1,1),
16, //kernel size,
Shape(1,1)
);
return d1;
}
int main(int argc, char **argv)
{
Context ctx = Context::cpu();
auto net = create_generator();
std::map<string, NDArray> args;
auto input = NDArray({1},Shape(1,1), ctx);
args["x"] = input.Copy(ctx);
net.InferArgsMap(ctx, &args, args);
//net.SimpleBind(ctx, args);
}
This is what I get
./a.out
terminate called after throwing an instance of 'dmlc::Error'
what(): [20:19:53] /usr/local/include/mxnet-cpp/symbol.hpp:219: Check failed: MXSymbolInferShapeEx(GetHandle(), keys.size(), keys.data(), arg_ind_ptr.data(), arg_shape_data.data(), &in_shape_size, &in_shape_ndim, &in_shape_data, &out_shape_size, &out_shape_ndim, &out_shape_data, &aux_shape_size, &aux_shape_ndim, &aux_shape_data, &complete) == 0 (-1 vs. 0) :
Stack trace:
[bt] (0) ./a.out(dmlc::LogMessageFatal::~LogMessageFatal()+0x25) [0x4076ed]
[bt] (1) ./a.out() [0x409c5f]
[bt] (2) ./a.out() [0x40a8d0]
[bt] (3) ./a.out() [0x405067]
[bt] (4) /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7f59b49fe2e1]
[bt] (5) ./a.out() [0x4044ca]
I am using debian9 ,
last mxnet compiled from source ,
g++4.9 using -std=c++11