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

Fix deprecated methods of Chainer 1.24.0 #7

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

massongit
Copy link
Contributor

I fixed deprecated methods of Chainer 1.24.0: chainer.cuda.get_device and bi_lstm.BiLSTM_CNN_CRF.zerograds (chainer.Chain.zerograds).

@aonotas
Copy link
Owner

aonotas commented Sep 27, 2017

Thank you for your great PR!

@aonotas
Copy link
Owner

aonotas commented Sep 27, 2017

Could you fix your code to define own chainer util functions like followings:

# util_chainer.py
def my_cuda_get_device(cuda, device_id):
    if version < '2.0':
        cuda.get_device(device_id).use()
    else:
        # v2.0
        cuda.get_device_from_id(device_id).use()


def my_cleargrads(net):
    if version < '2.0':
        net.zerograds()
    else:
        # v2.0
        net.cleargrads()

# main.py
from util_chainer import my_cuda_get_device, my_cleargrads

@aonotas
Copy link
Owner

aonotas commented Sep 27, 2017

if you fix your code, I will merge it!
Thank you for your help :)

@massongit
Copy link
Contributor Author

Thank you for your comments!

I think it is unnecessary to define own chainer util functions.
As the reason:

  • This tool supports Chainer 2.1.0 and 1.24.0.
  • chainer.cuda.get_device was deprecated on Chainer 1.23.0 (earlier Chainer 1.24.0).
  • chainer.Chain.zerograds was deprecated on Chainer 1.15.0 (earlier Chainer 1.24.0).

@aonotas
Copy link
Owner

aonotas commented Sep 27, 2017

OK! Thank you for your help :)
I will merge your PR.

@aonotas aonotas merged commit 859695a into aonotas:master Sep 27, 2017
@massongit massongit deleted the feature/fix_deprecated branch September 27, 2017 13:04
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

Successfully merging this pull request may close these issues.

2 participants