device.py 531 字节
Newer Older
Q
init  
qijun 已提交
1 2 3 4 5
"""
All util layers.
"""

from ..layer_helper import LayerHelper
Y
Yang Yu 已提交
6
from ..framework import unique_name
Q
init  
qijun 已提交
7 8 9 10

__all__ = ['get_places']


Y
Yang Yu 已提交
11
def get_places(device_count=0, device_type="CPU"):
Q
init  
qijun 已提交
12
    helper = LayerHelper('get_places', **locals())
Y
Yang Yu 已提交
13
    out_places = helper.create_variable(name=unique_name(helper.name + ".out"))
Q
init  
qijun 已提交
14 15 16 17
    helper.append_op(
        type='get_places',
        outputs={"Out": [out_places]},
        attrs={
Q
qijun 已提交
18
            "device_type": device_type,
Q
qijun 已提交
19
            'device_count': device_count,
Q
init  
qijun 已提交
20 21 22
        })

    return out_places