2023-09-22 01:25:14 +08:00
|
|
|
//===- tensor.cpp ---------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
// Also available under a BSD-style license. See LICENSE.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include <ATen/FunctionalTensorWrapper.h>
|
|
|
|
|
|
|
|
#include "tensor.h"
|
|
|
|
|
|
|
|
namespace torch {
|
|
|
|
namespace lazy {
|
|
|
|
|
2024-01-30 01:59:33 +08:00
|
|
|
at::Tensor
|
|
|
|
CreateFunctionalizedAtenFromLtcTensor(const LazyTensorPtr <c_tensor) {
|
2023-09-22 01:25:14 +08:00
|
|
|
at::Tensor tensor = CreateAtenFromLtcTensor(ltc_tensor);
|
|
|
|
if (!c10::impl::tls_is_dispatch_key_excluded(
|
2024-01-30 01:59:33 +08:00
|
|
|
c10::DispatchKey::Functionalize) &&
|
2023-09-22 01:25:14 +08:00
|
|
|
!at::functionalization::impl::isFunctionalTensor(tensor)) {
|
|
|
|
return at::functionalization::impl::to_functional_tensor(tensor);
|
|
|
|
}
|
|
|
|
return tensor;
|
|
|
|
}
|
|
|
|
|
2024-01-30 01:59:33 +08:00
|
|
|
} // namespace lazy
|
|
|
|
} // namespace torch
|