Skip to content

Commit

Permalink
refactor: on_gpu and to_device in baseclass
Browse files Browse the repository at this point in the history
  • Loading branch information
hanxiao committed May 6, 2020
1 parent d483605 commit ac4b10f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions jina/executors/frameworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ def device(self):
try:
if self.framework == 'tensorflow':
import tensorflow as tf
if self.on_gpu:
devices = tf.config.experimental.list_physical_devices(device_type='GPU')
else:
devices = tf.config.experimental.list_physical_devices(device_type='CPU')
devices = tf.config.experimental.list_physical_devices(device_type='GPU' if self.on_gpu else 'CPU')
return devices[0]
elif self.framework == 'paddlepaddle':
import paddle.fluid as fluid
Expand Down

0 comments on commit ac4b10f

Please sign in to comment.