mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 00:21:07 +01:00
Pull Request resolved: https://github.com/pytorch/pytorch/pull/166077 Approved by: https://github.com/malfet ghstack dependencies: #166076
26 lines
849 B
C
26 lines
849 B
C
#pragma once
|
|
|
|
// This file implements tensor.h. We separated out the Tensor struct so that
|
|
// other files can depend on the Tensor struct (like library.h) and the
|
|
// implementations of the Tensor methods can depend on APIs in library.h
|
|
// without circular dependencies.
|
|
|
|
#include <torch/csrc/stable/stableivalue_conversions.h>
|
|
#include <torch/csrc/stable/tensor_struct.h>
|
|
#include <torch/headeronly/core/ScalarType.h>
|
|
#include <torch/headeronly/macros/Macros.h>
|
|
#include <torch/headeronly/util/shim_utils.h>
|
|
|
|
HIDDEN_NAMESPACE_BEGIN(torch, stable)
|
|
|
|
using torch::headeronly::ScalarType;
|
|
|
|
inline ScalarType Tensor::scalar_type() const {
|
|
int32_t dtype;
|
|
TORCH_ERROR_CODE_CHECK(aoti_torch_get_dtype(ath_.get(), &dtype));
|
|
return torch::stable::detail::to<ScalarType>(
|
|
torch::stable::detail::from(dtype));
|
|
}
|
|
|
|
HIDDEN_NAMESPACE_END(torch, stable)
|