tf.device

参考    tf.device - 云+社区 - 腾讯云

为在此上下文中创建/执行的操作系统指定设备。

tf.device(device_name)

device_name可以完全指定,如“/job:worker/task:1/device:cpu:0”,或者部分指定,只包含“/”分隔字段的子集。指定的任何字段都覆盖来自外部范围的设备注释。例如:

with tf.device('/job:foo'):
  # ops created here have devices with /job:foo
  with tf.device('/job:bar/task:0/device:gpu:2'):
    # ops created here have the fully specified device above
  with tf.device('/device:gpu:1'):
    # ops created here have the device '/job:foo/device:gpu:1'

参数:

  • device_name:要在上下文中使用的设备名称。

返回值:

  • 上下文管理器,指定新创建的操作系统使用的默认设备。

可能产生的异常:

  • RuntimeError: If a function is passed in.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Wanderer001

ROIAlign原理

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值