Browse Source

Update FAQ-ncnn-produce-wrong-result.md (#5220)

tags/20240102
lll143653 GitHub 2 years ago
parent
commit
d4dcb3a2f0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      docs/how-to-use-and-FAQ/FAQ-ncnn-produce-wrong-result.md

+ 10
- 1
docs/how-to-use-and-FAQ/FAQ-ncnn-produce-wrong-result.md View File

@@ -185,4 +185,13 @@ ncnn::Net net;
net.opt.use_fp16_packed = false;
net.opt.use_fp16_storage = false;
net.opt.use_fp16_arithmetic = false;
```
```

### make data contiguous
If you find the output of pnnx.py and ncnn.py (generated by pnnx) is different, This may be due to data discontiguous. You can set the ncnn.py as follows and moditfity other codes:
``` python
def test_inference():
torch.manual_seed(0)
in0 = torch.rand(1, 3, 224, 224, dtype=torch.float)
in0.contiguous()
```

Loading…
Cancel
Save