Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions torch_xla/csrc/torch_util.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "torch_xla/csrc/torch_util.h"

#include "tensorflow/compiler/xla/xla_client/debug_macros.h"

namespace torch_xla {

at::Tensor CopyTensor(const at::Tensor& ref) {
Expand All @@ -15,13 +17,14 @@ at::Tensor CopyTensor(const at::Tensor& ref, at::ScalarType dest_type) {
at::ScalarType GetScalarType(at::Scalar scalar) {
if (scalar.isFloatingPoint()) {
return at::kDouble;
} else if (scalar.isIntegral(/*includeBool=*/false)) {
return at::kLong;
} else if (scalar.isBoolean()) {
return at::kBool;
} else if (scalar.isComplex()) {
return at::kComplexDouble;
} else {
XLA_CHECK(scalar.isIntegral(/*includeBool=*/false));
return at::kLong;
}
XLA_ERROR() << "Unknown type for scalar";
}

} // namespace torch_xla
7 changes: 0 additions & 7 deletions torch_xla/csrc/torch_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
#include <c10/core/ScalarType.h>
#include <c10/util/Optional.h>

#include <memory>
#include <vector>

#include "torch/csrc/autograd/variable.h"
#include "torch/csrc/jit/pybind_utils.h"
#include "torch_xla/csrc/tensor.h"

namespace torch_xla {

// Makes a deep copy of an ATEN tensor.
Expand Down