MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / PrintDenseTensorIntType

Function PrintDenseTensorIntType

paddle/fluid/framework/device_worker.cc:115–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113 }
114}
115std::string PrintDenseTensorIntType(phi::DenseTensor* tensor,
116 int64_t start,
117 int64_t end,
118 char separator = ',',
119 bool need_leading_separator = true) {
120 auto count = tensor->numel();
121 if (start < 0 || end > count) {
122 VLOG(3) << "access violation";
123 return "access violation";
124 }
125 if (start >= end) return "";
126 std::ostringstream os;
127 if (!need_leading_separator) {
128 os << static_cast<uint64_t>(tensor->data<int64_t>()[start]);
129 start++;
130 }
131 for (int64_t i = start; i < end; i++) {
132 // os << ":" << static_cast<uint64_t>(tensor->data<int64_t>()[i]);
133 os << separator << static_cast<uint64_t>(tensor->data<int64_t>()[i]);
134 }
135 return os.str();
136}
137
138void PrintDenseTensorIntType(phi::DenseTensor* tensor,
139 int64_t start,

Callers 1

PrintDenseTensorFunction · 0.85

Calls 3

to_stringFunction · 0.50
numelMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected