blob: 0487726e68d7c5085493f05cce39f07bd682989b [file] [log] [blame]
#pragma once
#include <cstdint>
namespace torch {
enum class DeviceType {CPU=0, CUDA=1};
struct Device {
DeviceType type;
int64_t index;
bool is_default; // is default device for type.
Device(DeviceType type, int64_t index, bool is_default);
bool operator==(const Device& rhs);
inline int64_t deviceInt64() { return (this->is_default || this->type == DeviceType::CPU) ? -1 : this->index; }
};
}