Skip to content

Commit

Permalink
add notes for gradient check
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesShang committed Dec 5, 2018
1 parent 0418f23 commit 78a61ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
print(output.shape)
```

### Known issues:
### Known Issues:

- [ ] Gradient check w.r.t offset
- [ ] Backward is not reentrant

This is adaption of the official [Deformable-ConvNets](https://github.com/msracver/Deformable-ConvNets/tree/master/DCNv2_op).
This is an adaption of the official [Deformable-ConvNets](https://github.com/msracver/Deformable-ConvNets/tree/master/DCNv2_op).
I have ran the gradient check for many times with DOUBLE type. Every tensor **except offset** passes.
However, when I set the offset to 0.5, it passes. I'm still wondering what cause this problem. Is it because some
non-differential points?
Expand Down
18 changes: 8 additions & 10 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,14 @@ def example():
try:
check_gradient_double()
except TypeError:
print('''You can swith to double precision in dcn_v2_func.py by (un)commenting these two lines:
from _ext import dcn_v2 as _backend
from _ext import dcn_v2_double as _backend''')
print('Your tensor may not be **double** type')
print('Switching to **float** type')
print('''****** You can swith to double precision in dcn_v2_func.py by (un)commenting these two lines:
****** from _ext import dcn_v2 as _backend
****** from _ext import dcn_v2_double as _backend''')
print('****** Your tensor may not be **double** type')
print('****** Switching to **float** type')

check_gradient()
finally:
print('Note: backward is not reentrant error may not be a serious problem, '
'since the max error is less than 1e-7\n'
'Still looking for what trigger this problem')

example()
print('****** Note: backward is not reentrant error may not be a serious problem, '
'****** since the max error is less than 1e-7\n'
'****** Still looking for what trigger this problem')

0 comments on commit 78a61ed

Please sign in to comment.