Did you try to add the suggested clone() operation to the code?
E.g. start at the beginning by adding it to the torch::from_blob() operation and try to isolate the line of code, which raises the error.