Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Sample python bilinear initializer at integral points in y-direction
Browse files Browse the repository at this point in the history
  • Loading branch information
vlado committed Dec 11, 2018
1 parent ee5f699 commit 653f3e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/mxnet/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _init_bilinear(self, _, arr):
c = (2 * f - 1 - f % 2) / (2. * f)
for i in range(np.prod(shape)):
x = i % shape[3]
y = (i / shape[3]) % shape[2]
y = (i // shape[3]) % shape[2]
weight[i] = (1 - abs(x / f - c)) * (1 - abs(y / f - c))
arr[:] = weight.reshape(shape)

Expand Down Expand Up @@ -656,7 +656,7 @@ def _init_weight(self, _, arr):
c = (2 * f - 1 - f % 2) / (2. * f)
for i in range(np.prod(shape)):
x = i % shape[3]
y = (i / shape[3]) % shape[2]
y = (i // shape[3]) % shape[2]
weight[i] = (1 - abs(x / f - c)) * (1 - abs(y / f - c))
arr[:] = weight.reshape(shape)

Expand Down

0 comments on commit 653f3e6

Please sign in to comment.