mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Remove deprecated alias macro(1/3) (#137556)
**Detailed Descriptions:** - Remove AT_ERROR Macro Pull Request resolved: https://github.com/pytorch/pytorch/pull/137556 Approved by: https://github.com/ezyang
This commit is contained in:
@ -199,7 +199,8 @@ static void restoreContainerTypeTags(
|
||||
} else if (is<ListType>(*type)) {
|
||||
ivalue.toList().unsafeSetElementType(type->containedType(0));
|
||||
} else {
|
||||
AT_ERROR("Unknown type for tag restoration: " + type->annotation_str());
|
||||
TORCH_CHECK(
|
||||
false, "Unknown type for tag restoration: " + type->annotation_str());
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,7 +626,8 @@ PickleOpCode Unpickler::readInstruction() {
|
||||
device.is_hpu() || device.is_mps() || device.is_privateuseone()) {
|
||||
tensor = tensor.to(device, tensor.scalar_type());
|
||||
} else if (device.type() != DeviceType::CPU) {
|
||||
AT_ERROR(
|
||||
TORCH_CHECK(
|
||||
false,
|
||||
"supported devices include CPU, CUDA, HPU and ",
|
||||
c10::get_privateuse1_backend(),
|
||||
" however got ",
|
||||
@ -660,7 +662,8 @@ PickleOpCode Unpickler::readInstruction() {
|
||||
stack_.begin() + static_cast<std::ptrdiff_t>(key_pos), stack_.end());
|
||||
} break;
|
||||
default: {
|
||||
AT_ERROR(
|
||||
TORCH_CHECK(
|
||||
false,
|
||||
"Unknown opcode for unpickling at ",
|
||||
// NOLINTNEXTLINE(performance-no-int-to-ptr)
|
||||
reinterpret_cast<void*>(opcode),
|
||||
@ -708,7 +711,7 @@ void Unpickler::readGlobal(
|
||||
stack_.back().toList().unsafeSetElementType(IntType::get());
|
||||
});
|
||||
} else {
|
||||
AT_ERROR("Unknown pickler class id", class_name);
|
||||
TORCH_CHECK(false, "Unknown pickler class id", class_name);
|
||||
}
|
||||
} else if (module_name == "torch.jit._pickle") {
|
||||
if (class_name == "build_tensor_from_id") {
|
||||
@ -758,7 +761,7 @@ void Unpickler::readGlobal(
|
||||
} else if (class_name == "build_boollist") {
|
||||
elem_type = BoolType::get();
|
||||
} else {
|
||||
AT_ERROR("Unknown pickler class id ", class_name);
|
||||
TORCH_CHECK(false, "Unknown pickler class id ", class_name);
|
||||
}
|
||||
// Unpickle a list specialization (e.g. List[Tensor], List[int], ...)
|
||||
globals_.emplace_back([this, elem_type] {
|
||||
@ -1090,7 +1093,7 @@ void Unpickler::readSlowWithBuffer(char* dest, size_t sz) {
|
||||
AT_ASSERT(sz <= buffer_.size());
|
||||
buffer_remaining_ = reader_(buffer_.data(), buffer_.size());
|
||||
if (buffer_remaining_ < needed) {
|
||||
AT_ERROR("Unexpected end of pickler archive.");
|
||||
TORCH_CHECK(false, "Unexpected end of pickler archive.");
|
||||
}
|
||||
memcpy(dest + from_old_buf, buffer_.data(), needed);
|
||||
buffer_pos_ = needed; // assignment (0'ed from read)
|
||||
@ -1128,7 +1131,7 @@ std::string Unpickler::readBytes(size_t length) {
|
||||
const size_t needed = length - from_old_buf;
|
||||
size_t nread = reader_(&data[from_old_buf], needed);
|
||||
if (nread != needed) {
|
||||
AT_ERROR("Unexpected end of pickler archive.");
|
||||
TORCH_CHECK(false, "Unexpected end of pickler archive.");
|
||||
}
|
||||
buffer_remaining_ = 0;
|
||||
// buffer_pos_ has no meaning with buffer_remaining_ == 0.
|
||||
@ -1170,7 +1173,7 @@ void Unpickler::readListElements(IValue list_ivalue, size_t start) {
|
||||
list.emplace_back(elem);
|
||||
}
|
||||
} else {
|
||||
AT_ERROR("Unknown IValue list kind: ", list_ivalue.tagKind());
|
||||
TORCH_CHECK(false, "Unknown IValue list kind: ", list_ivalue.tagKind());
|
||||
}
|
||||
stack_.erase(
|
||||
stack_.begin() + static_cast<std::ptrdiff_t>(start), stack_.end());
|
||||
|
Reference in New Issue
Block a user