pytorch/c10/core/UndefinedTensorImpl.cpp
Edward Yang 3d0a470d89 Rename DispatchKey::UndefinedTensorId to Undefined (#32728)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/32728

It doesn't have much to do with tensors anymore.

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

Test Plan: Imported from OSS

Differential Revision: D19628093

Pulled By: ezyang

fbshipit-source-id: 4d57111cdf44ba347bec8a32bb5b4b47a83c1eaf
2020-01-30 11:47:40 -08:00

45 lines
1.2 KiB
C++

#include <c10/core/UndefinedTensorImpl.h>
#include <c10/util/Exception.h>
namespace c10 {
// should this use the globalContext? Can it get a context passed in somehow?
UndefinedTensorImpl::UndefinedTensorImpl()
: TensorImpl(DispatchKey::Undefined, caffe2::TypeMeta(), c10::nullopt) {
}
IntArrayRef UndefinedTensorImpl::sizes() const {
AT_ERROR("sizes() called on undefined Tensor");
}
int64_t UndefinedTensorImpl::size(int64_t d) const {
AT_ERROR("size(dim) called on an undefined Tensor");
}
int64_t UndefinedTensorImpl::stride(int64_t d) const {
AT_ERROR("stride(dim) called on an undefined Tensor");
}
int64_t UndefinedTensorImpl::dim() const {
AT_ERROR("dim() called on undefined Tensor");
}
bool UndefinedTensorImpl::has_storage() const {
AT_ERROR("has_storage() called on undefined Tensor");
}
const Storage& UndefinedTensorImpl::storage() const {
AT_ERROR("storage() called on undefined Tensor");
}
int64_t UndefinedTensorImpl::storage_offset() const {
AT_ERROR("storage_offset() called on an undefined Tensor");
}
IntArrayRef UndefinedTensorImpl::strides() const {
AT_ERROR("strides() called on undefined Tensor");
}
UndefinedTensorImpl UndefinedTensorImpl::_singleton;
}