Skip to content

Commit e8ecbcd

Browse files
bwastifacebook-github-bot
authored andcommitted
Move IValue to ATen/core (pytorch#11610)
Summary: unblocks D9202320 Pull Request resolved: pytorch#11610 Differential Revision: D9774853 Pulled By: bwasti fbshipit-source-id: 4798223f6de680a7152283e8cad8814da7f90209
1 parent d4dde0b commit e8ecbcd

File tree

10 files changed

+464
-460
lines changed

10 files changed

+464
-460
lines changed

aten/src/ATen/Formatting.h

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1 @@
1-
#pragma once
2-
3-
#include <iostream>
4-
#include "ATen/Type.h"
5-
#include "ATen/core/Scalar.h"
6-
7-
namespace at {
8-
9-
AT_API std::ostream& operator<<(std::ostream & out, IntList list);
10-
AT_API std::ostream& operator<<(std::ostream & out, Backend b);
11-
AT_API std::ostream& operator<<(std::ostream & out, const Type & t);
12-
AT_API std::ostream& print(std::ostream& stream, const Tensor & tensor, int64_t linesize);
13-
static inline std::ostream& operator<<(std::ostream & out, const Tensor & t) {
14-
return print(out,t,80);
15-
}
16-
static inline void print(const Tensor & t, int64_t linesize=80) {
17-
print(std::cout,t,linesize);
18-
}
19-
20-
static inline std::ostream& operator<<(std::ostream & out, Scalar s) {
21-
return out << (s.isFloatingPoint() ? s.toDouble() : s.toLong());
22-
}
23-
24-
}
1+
#include <ATen/core/Formatting.h>

aten/src/ATen/Formatting.cpp renamed to aten/src/ATen/core/Formatting.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#include "ATen/Formatting.h"
2-
3-
#include <ATen/ATen.h>
1+
#include "ATen/core/Formatting.h"
42

53
#include <cmath>
64
#include <cstdint>

aten/src/ATen/core/Formatting.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
3+
#include <ATen/core/Scalar.h>
4+
#include <ATen/core/Tensor.h>
5+
#include <ATen/core/TensorMethods.h>
6+
#include <ATen/core/Type.h>
7+
#include <iostream>
8+
9+
namespace at {
10+
11+
AT_API std::ostream& operator<<(std::ostream & out, IntList list);
12+
AT_API std::ostream& operator<<(std::ostream & out, Backend b);
13+
AT_API std::ostream& operator<<(std::ostream & out, const Type & t);
14+
AT_API std::ostream& print(std::ostream& stream, const Tensor & tensor, int64_t linesize);
15+
static inline std::ostream& operator<<(std::ostream & out, const Tensor & t) {
16+
return print(out,t,80);
17+
}
18+
static inline void print(const Tensor & t, int64_t linesize=80) {
19+
print(std::cout,t,linesize);
20+
}
21+
22+
static inline std::ostream& operator<<(std::ostream & out, Scalar s) {
23+
return out << (s.isFloatingPoint() ? s.toDouble() : s.toLong());
24+
}
25+
26+
}

aten/src/ATen/Tensor.cpp renamed to aten/src/ATen/core/Tensor.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#include <ATen/Tensor.h>
2-
#include <ATen/Type.h>
3-
#include <ATen/Formatting.h>
1+
#include <ATen/core/Tensor.h>
2+
#include <ATen/core/Formatting.h>
3+
#include <ATen/core/Type.h>
44

55
#include <iostream>
66

torch/csrc/jit/ivalue.cpp renamed to aten/src/ATen/core/ivalue.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
#include "torch/csrc/jit/assertions.h"
2-
#include "torch/csrc/jit/ivalue.h"
3-
#include <ATen/ATen.h>
1+
#include <ATen/core/ivalue.h>
2+
#include <ATen/core/Formatting.h>
43

54
#define TORCH_FORALL_TAGS(_) \
65
_(None) _(Tensor) _(Double) _(Int) _(Tuple) _(IntList) _(DoubleList) _(String) _(TensorList)
76

87
namespace torch { namespace jit {
98

9+
AT_API c10::intrusive_ptr<ConstantString> ConstantString::create(std::string str_) {
10+
return c10::make_intrusive<ConstantString>(std::move(str_));
11+
}
12+
1013
namespace {
1114

1215
template<typename Elem>

0 commit comments

Comments
 (0)