mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/51048 There doesn't seem to be any reason to prohibit accessing the always-zero storage_offset of those TensorImpls that prohibit set_storage_offset. ghstack-source-id: 120714379 Test Plan: CI Reviewed By: ezyang Differential Revision: D26008499 fbshipit-source-id: cd92ac0afdebbd5cf8f04df141843635113b6444
37 lines
1018 B
C++
37 lines
1018 B
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) {
|
|
}
|
|
|
|
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");
|
|
}
|
|
|
|
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");
|
|
}
|
|
|
|
void UndefinedTensorImpl::set_storage_offset(int64_t) {
|
|
AT_ERROR("set_storage_offset() called on an undefined Tensor");
|
|
}
|
|
|
|
IntArrayRef UndefinedTensorImpl::strides() const {
|
|
AT_ERROR("strides() called on undefined Tensor");
|
|
}
|
|
UndefinedTensorImpl UndefinedTensorImpl::_singleton;
|
|
|
|
}
|