This PR fixes a bug where SyncedArray::cast with write_only == true returns array before fill and zero evaluations for a narrowed array.
import numpy as np
import nnabla as nn
import nnabla.functions as F
size = 4
a = nn.NdArray((size,))
a.fill(3)
b = nn.NdArray((size,))
c = b.narrow(0, 0, size)
# F.identity uses `write_only == true` casting for the destination array
F.identity(a, outputs=[c])
# Before fix: c == [0, 0, 0, 0]
# After fix: c == [3, 3, 3, 3]
np.testing.assert_equal(c.get_data(mode='r'), a.get_data())
This PR fixes a bug where
SyncedArray::cast
withwrite_only == true
returns array before fill and zero evaluations for a narrowed array.