scikit-kge icon indicating copy to clipboard operation
scikit-kge copied to clipboard

Correction in base.py file

Open svjan5 opened this issue 7 years ago • 3 comments

Here: https://github.com/mnick/scikit-kge/blob/master/skge/base.py#L130 self.batch_size = np.ceil(len(xys) / self.nbatches) self.batch_size = int(np.ceil(len(xys) / self.nbatches))

In the latest stable version of numpy (1.13.0) np.ceil() returns a float value not int.

Because of this error, my code was crashing with:

TypeError: slice indices must be integers or None or have an index method

Please make the change.

svjan5 avatar Jun 30 '17 10:06 svjan5

I still see same self.batch_size = np.ceil(len(xys) / self.nbatches)

grv1207 avatar Nov 27 '17 11:11 grv1207

I still found this mistake: "sub_arys.append(_nx.swapaxes(sary[st:end], axis, 0))" "slice indices must be integers or None or have an index method"

wanghaoyu0408 avatar Apr 10 '18 14:04 wanghaoyu0408

This also happened with me for the following snippet in base.py.

def _optim(self, xys):
        idx = np.arange(len(xys), dtype=int)
        self.batch_size = np.ceil(len(xys) / self.nbatches)
        batch_idx = np.arange(self.batch_size, len(xys), self.batch_size, dtype=int)

I just introduced the dtype=int parameter to fix it.

tridivb avatar Dec 29 '18 12:12 tridivb