TypeError: `pad_width` must be of integral type.

See original GitHub issue

Hello, thank you for your code. When I try to run the train.py to do a demo, but I get a “TypeError: pad_width must be of integral type.”, and it points to the “Keras-FCN\utils\SegDataGenerator.py”, line 238, in next x = np.lib.pad(x, ((pad_h / 2, pad_h - pad_h / 2), (pad_w / 2, pad_w - pad_w / 2), (0, 0)), ‘constant’, constant_values=0.)". I don’t know how to fix this problem, can you give me some suggestions?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

8reactions
jermenkoocommented, Nov 4, 2017

@lxyhahaha you seem to be using Python 3 where / does floating point division by default; you might want to change that to // which performs integral division.

5reactions
WenbinYang123commented, Oct 9, 2017

@anas-899 I solved it by following code: image

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: pad_width must be of integral type. #12852 - GitHub
np.pad() raises an exception when trying to pad multiple axes with before and after padding. Reproducing code example: import numpy as np a ......
Read more >
How to pad arrays by a variable amount? - Stack Overflow
Unfortunately I am getting the error message: TypeError: pad_width must be of integral type. Edit: i changed pad_h to (max_h - p[0])//2 (and ......
Read more >
numpy.pad — NumPy v1.25.dev0 Manual
(pad,) or int is a shortcut for before = after = pad width for all axes. ... value of the linear_ramp and that...
Read more >
cupy.padding.pad — Chainer 1.24.0 documentation
[docs]def pad(array, pad_width, mode, **keywords): """Returns padded array. ... 'i': raise TypeError('pad_width must be of integral type.
Read more >
numpy/lib/arraypad.py - Fossies
94 pad_width : sequence of tuple[int, int] 95 Pad width on both sides for each dimension ... 'i': 741 raise TypeError('`pad_width` must be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found