Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow NHWC格式 转换成 CAFFE NCHW格式,出现错误,隔一个数字就出现一个0。 #1618

Closed
maoyuanpeng opened this issue Aug 9, 2021 · 1 comment

Comments

@maoyuanpeng
Copy link

maoyuanpeng commented Aug 9, 2021

photo = cv::imread("test_image/2007_000039.jpg");
photo.convertTo(photo,CV_32FC3);
auto hostTensor = Tensor::create<float>({1,224,224,3},NULL,MNN::Tensor::TENSORFLOW);
auto data = hostTensor->host<float>();
memcpy(data,photo.data,hostTensor->size());
inputTensor->copyFromHostTensor(hostTensor);

inpurTensor是CAFFE格式的,类型也是float
hostTensor内容
image
copy后inputTensor的内容
image

@jxt1234
Copy link
Collaborator

jxt1234 commented Aug 12, 2021

这个是 NC4HW4 会补零上对齐,对外透出仍然是 CAFFE 以便用户建 host tensor

@jxt1234 jxt1234 closed this as completed Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants