Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correction in base.py file #3

Open
svjan5 opened this issue Jun 30, 2017 · 3 comments
Open

Correction in base.py file #3

svjan5 opened this issue Jun 30, 2017 · 3 comments

Comments

@svjan5
Copy link

svjan5 commented Jun 30, 2017

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.

eriq-augustine added a commit to eriq-augustine/scikit-kge that referenced this issue Jul 12, 2017
eriq-augustine added a commit to eriq-augustine/scikit-kge that referenced this issue Jul 12, 2017
@grv1207
Copy link

grv1207 commented Nov 27, 2017

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

@wanghaoyu0408
Copy link

wanghaoyu0408 commented Apr 10, 2018

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"

@tridivb
Copy link

tridivb commented Dec 29, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants