def _initialize(self, flat_size, fill_value, dtype):
if self.nans:
# For avoiding branches
flat_size += 1
if self.forced_fill_value is None:
ret = np.full(flat_size, fill_value, dtype=dtype)
else:
ret = np.full(flat_size, self.forced_fill_value, dtype=dtype)
counter = np.full_like(ret, self.counter_fill_value, dtype=self.counter_dtype)
if self.mean_fill_value is not None:
mean = np.full_like(ret, self.mean_fill_value, dtype=ret.dtype)
else:
mean = None
return ret, counter, mean
评论列表
文章目录