mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Remove deprecated variable_tensor_functions (#15003)
Summary: Removing the deprecated functions in `torch/csrc/variable_tensor_functions.h` (like `torch::CPU`) and corresponding implementations from `torch/csrc/torch.cpp` from master after the release. ezyang gchanan soumith Pull Request resolved: https://github.com/pytorch/pytorch/pull/15003 Differential Revision: D13418086 Pulled By: goldsborough fbshipit-source-id: a0accdf6f7b0efa1ec07ac7b74b86ff2da37543f
This commit is contained in:
parent
0552326846
commit
73ee7fda4c
|
|
@ -53,7 +53,6 @@
|
|||
#include "torch/csrc/jit/symbolic_variable.h"
|
||||
#include "torch/csrc/jit/tracer.h"
|
||||
#include "torch/csrc/utils/hash.h"
|
||||
#include "torch/csrc/variable_tensor_functions.h"
|
||||
#include "torch/csrc/autograd/generated/variable_factories.h"
|
||||
|
||||
#include "torch/csrc/autograd/engine.h"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "torch/csrc/jit/interned_strings.h"
|
||||
|
||||
#include "torch/csrc/utils/functional.h"
|
||||
#include "torch/csrc/variable_tensor_functions.h"
|
||||
#include "torch/csrc/autograd/generated/variable_factories.h"
|
||||
|
||||
#include <ATen/ATen.h>
|
||||
|
|
|
|||
|
|
@ -194,7 +194,6 @@ set(TORCH_SRCS
|
|||
${TORCH_SRC_DIR}/csrc/jit/script/module.cpp
|
||||
${TORCH_SRC_DIR}/csrc/jit/tracer.cpp
|
||||
${TORCH_SRC_DIR}/csrc/jit/hooks_for_testing.cpp
|
||||
${TORCH_SRC_DIR}/csrc/torch.cpp
|
||||
${TORCH_SRC_DIR}/csrc/utils/tensor_flatten.cpp
|
||||
${TORCH_SRC_DIR}/csrc/utils/variadic.cpp
|
||||
${TORCH_ROOT}/test/cpp/jit/no-gtest.cpp
|
||||
|
|
|
|||
|
|
@ -114,7 +114,6 @@ FusedKernelCPU::FusedKernelCPU(
|
|||
std::move(chunk_desc),
|
||||
std::move(concat_desc),
|
||||
has_random) {
|
||||
auto& config = getConfig();
|
||||
TempFile so_file(so_template, 3);
|
||||
TempFile cpp_file(cpp_template, 4);
|
||||
cpp_file.write(code_);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@
|
|||
#include <torch/csrc/jit/ivalue.h>
|
||||
#include <torch/csrc/jit/constants.h>
|
||||
#include <torch/csrc/jit/operator.h>
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
#include <torch/csrc/jit/script/jit_exception.h>
|
||||
|
||||
#include <exception>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
#include <torch/csrc/jit/ir.h>
|
||||
#include <torch/csrc/jit/pybind_utils.h>
|
||||
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
#include <torch/csrc/autograd/python_engine.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <torch/csrc/jit/operator.h>
|
||||
#include <torch/csrc/jit/custom_operator.h>
|
||||
#include <torch/csrc/jit/script/jit_exception.h>
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
|
||||
#include <ATen/ExpandUtils.h>
|
||||
#include <ATen/WrapDimUtils.h>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <torch/csrc/autograd/engine.h>
|
||||
#include <torch/csrc/jit/passes/dead_code_elimination.h>
|
||||
#include <torch/csrc/jit/passes/remove_expands.h>
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
#include <torch/csrc/utils/python_strings.h>
|
||||
#include <torch/csrc/utils/tensor_new.h>
|
||||
#include <torch/csrc/utils/tensor_types.h>
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
|
||||
#include <ATen/ATen.h>
|
||||
|
||||
|
|
@ -279,7 +278,7 @@ void initialize_python_bindings() {
|
|||
py_bind_tensor_types(tensor_types);
|
||||
|
||||
// Use torch.float32 as the default tensor type
|
||||
set_default_tensor_type(torch::CPU(kFloat));
|
||||
set_default_tensor_type(at::globalContext().getVariableType(at::Backend::CPU, at::kFloat));
|
||||
}
|
||||
|
||||
static void py_bind_tensor_types(const std::vector<PyTensorType>& tensor_types) {
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
#include <torch/csrc/autograd/generated/VariableType.h>
|
||||
#include <torch/csrc/autograd/variable.h>
|
||||
|
||||
namespace torch {
|
||||
at::TypeExtendedInterface& getVariableType(at::Backend backend, at::ScalarType type) {
|
||||
return *autograd::VariableType::getVariableTypeFromBaseType(at::getNonVariableType(backend, type));
|
||||
}
|
||||
|
||||
at::TypeExtendedInterface& CPU(at::ScalarType type) {
|
||||
return torch::getVariableType(at::Backend::CPU, type);
|
||||
}
|
||||
|
||||
at::TypeExtendedInterface& CUDA(at::ScalarType type) {
|
||||
return torch::getVariableType(at::Backend::CUDA, type);
|
||||
}
|
||||
|
||||
at::Tensor toTensor(const at::Scalar& scalar) {
|
||||
return autograd::make_variable(scalar_to_tensor(scalar));
|
||||
}
|
||||
|
||||
void set_requires_grad(at::Tensor& tensor, bool requires_grad) noexcept {
|
||||
autograd::as_variable_ref(tensor).set_requires_grad(requires_grad);
|
||||
}
|
||||
|
||||
bool requires_grad(const at::Tensor& tensor) noexcept {
|
||||
return autograd::as_variable_ref(tensor).requires_grad();
|
||||
}
|
||||
} // namespace torch
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <ATen/ATen.h>
|
||||
#include <ATen/core/Deprecated.h>
|
||||
#include <torch/csrc/THP_export.h>
|
||||
|
||||
namespace torch {
|
||||
|
||||
// NOTE: This API is currently highly experimental and may change drastically
|
||||
// in the near future.
|
||||
|
||||
// These functions provide a small wrapper around aten ensuring
|
||||
// that we create tensors with type Variable rather than raw tensors
|
||||
// when we create new tensors. We also provide a few accessors like
|
||||
// requires_grad that make it easier to get to varible information when we have
|
||||
// a at::Tensor
|
||||
|
||||
/// Returns a `TypeExtendedInterface` object for the given backend (e.g.
|
||||
/// `at::kCPU`) and `ScalarType` (e.g. `at::kDouble`).
|
||||
/// TODO: Eliminate this function as much as possible
|
||||
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& getVariableType(
|
||||
at::Backend backend,
|
||||
at::ScalarType type));
|
||||
|
||||
/// Returns a `TypeExtendedInterface` object for the CPU backend and the given
|
||||
/// `ScalarType` (e.g. `at::kDouble`). Equivalent to `getVariableType(kCPU,
|
||||
/// type)`.
|
||||
/// TODO: Eliminate this function as much as possible
|
||||
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CPU(at::ScalarType type));
|
||||
|
||||
/// Returns a `TypeExtendedInterface` object for the CUDA backend and the given
|
||||
/// `ScalarType` (e.g. `at::kDouble`). Equivalent to `getVariableType(kCUDA,
|
||||
/// type)`.
|
||||
/// TODO: Eliminate this function as much as possible
|
||||
AT_DEPRECATED(THP_CLASS at::TypeExtendedInterface& CUDA(at::ScalarType type));
|
||||
|
||||
/// Sets the `requires_grad` property of the given `Tensor`.
|
||||
AT_DEPRECATED(THP_CLASS void set_requires_grad(
|
||||
at::Tensor& tensor,
|
||||
bool requires_grad) noexcept);
|
||||
|
||||
/// Returns the `requires_grad` of the given `Tensor`.
|
||||
AT_DEPRECATED(THP_CLASS bool requires_grad(const at::Tensor& tensor) noexcept);
|
||||
|
||||
} // namespace torch
|
||||
|
|
@ -4,5 +4,3 @@
|
|||
#include <torch/all.h>
|
||||
// Python bindings for the C++ frontend (includes Python.h).
|
||||
#include <torch/python.h>
|
||||
// Deprecated tensor factories (to be removed).
|
||||
#include <torch/csrc/variable_tensor_functions.h>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user