utils.py 521 字节
Newer Older
Q
init  
qijun 已提交
1 2 3 4 5 6 7 8 9 10
"""
All util layers.
"""

from ..layer_helper import LayerHelper
from ..framework import Variable

__all__ = ['get_places']


Q
qijun 已提交
11
def get_places(trainer_count, device_type="CPU"):
Q
init  
qijun 已提交
12 13 14 15 16 17
    helper = LayerHelper('get_places', **locals())
    out_places = helper.create_tmp_variable(dtype=helper.input_dtype())
    helper.append_op(
        type='get_places',
        outputs={"Out": [out_places]},
        attrs={
Q
qijun 已提交
18
            "device_type": device_type,
Q
init  
qijun 已提交
19 20 21 22
            'trainer_count': trainer_count,
        })

    return out_places