Skip to content

Commit d4dcb3a

Browse files
authored
Update FAQ-ncnn-produce-wrong-result.md (#5220)
1 parent 070dac9 commit d4dcb3a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

docs/how-to-use-and-FAQ/FAQ-ncnn-produce-wrong-result.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,13 @@ ncnn::Net net;
185185
net.opt.use_fp16_packed = false;
186186
net.opt.use_fp16_storage = false;
187187
net.opt.use_fp16_arithmetic = false;
188-
```
188+
```
189+
190+
### make data contiguous
191+
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:
192+
``` python
193+
def test_inference():
194+
torch.manual_seed(0)
195+
in0 = torch.rand(1, 3, 224, 224, dtype=torch.float)
196+
in0.contiguous()
197+
```

0 commit comments

Comments
 (0)