tensorflow/core/common_runtime/dynamic_device_mgr_test.cc
// Return a fake device with the specified type and name.
Return a fake device with the specified type and name.
Return a fake device with the specified type and name .
static Device* CreateDevice(const char* type, const char* name) {
  class FakeDevice : public Device {
   public:
    explicit FakeDevice(const DeviceAttributes& attr) : Device(nullptr, attr) {}
    Status Sync() override { return Status::OK(); }
    Allocator* GetAllocator(AllocatorAttributes) override { return nullptr; }
  };
  DeviceAttributes attr;
  attr.set_name(name);
  attr.set_device_type(type);
  return new FakeDevice(attr);
}
static Device * CreateDevice ( const char * type , const char * name ) { class FakeDevice : public Device { public : explicit FakeDevice ( const DeviceAttributes & attr ) : Device ( nullptr , attr ) { } Status Sync ( ) override { return Status :: OK ( ) ; } Allocator * GetAllocator ( AllocatorAttributes ) override { return nullptr ; } } ; DeviceAttributes attr ; attr . set_name ( name ) ; attr . set_device_type ( type ) ; return new FakeDevice ( attr ) ; }
Return a fake device with the specified type and name.
Return a fake device with the specified type and name .