| 496 | } |
| 497 | |
| 498 | XrtContext::XrtContext(std::shared_ptr<XrtTfContext> tf_context, |
| 499 | string device_type) |
| 500 | : tf_context_(std::move(tf_context)), device_type_(std::move(device_type)) { |
| 501 | for (int i = 0; i < tf_context_->devices().size(); ++i) { |
| 502 | const DeviceAttributes& device = tf_context_->devices()[i]; |
| 503 | VLOG(2) << "Device: " << i << ": " << device.DebugString(); |
| 504 | if (device.device_type() == device_type_) { |
| 505 | tf_device_ids_.push_back(i); |
| 506 | VLOG(1) << "Accelerator device " << i << ": " << device.name(); |
| 507 | } |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | int XrtContext::device_count() const { return tf_device_ids_.size(); } |
| 512 |
nothing calls this directly
no test coverage detected