text
stringlengths 0
2.2M
|
---|
if (pos >= size())
|
return npos;
|
auto pred = [&](value_type x) { return str.find(x) == npos; };
|
string_view tmp{data_ + pos, size_ - pos};
|
auto first = tmp.begin();
|
auto last = tmp.end();
|
auto i = std::find_if(first, last, pred);
|
return i != last ? static_cast<size_type>(std::distance(first, i)) + pos
|
: npos;
|
}
|
size_type string_view::find_first_not_of(value_type ch,
|
size_type pos) const noexcept {
|
if (pos >= size())
|
return npos;
|
auto pred = [=](value_type x) { return x != ch; };
|
string_view tmp{data_ + pos, size_ - pos};
|
auto first = tmp.begin();
|
auto last = tmp.end();
|
auto i = std::find_if(first, last, pred);
|
return i != last ? static_cast<size_type>(std::distance(first, i)) + pos
|
: npos;
|
}
|
size_type string_view::find_first_not_of(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return find_first_not_of(string_view{str, n}, pos);
|
}
|
size_type string_view::find_first_not_of(const_pointer str,
|
size_type pos) const noexcept {
|
return find_first_not_of(string_view{str, strlen(str)}, pos);
|
}
|
size_type string_view::find_last_not_of(string_view str,
|
size_type pos) const noexcept {
|
string_view tmp{data_, pos < size_ ? pos + 1 : size_};
|
auto result = tmp.find_first_not_of(str);
|
if (result == npos)
|
return npos;
|
for (;;) {
|
auto next = tmp.find_first_not_of(str, result + 1);
|
if (next == npos)
|
return result;
|
result = next;
|
}
|
}
|
size_type string_view::find_last_not_of(value_type ch,
|
size_type pos) const noexcept {
|
return find_last_not_of(string_view{&ch, 1}, pos);
|
}
|
size_type string_view::find_last_not_of(const_pointer str, size_type pos,
|
size_type n) const noexcept {
|
return find_last_not_of(string_view{str, n}, pos);
|
}
|
size_type string_view::find_last_not_of(const_pointer str,
|
size_type pos) const noexcept {
|
return find_last_not_of(string_view{str, strlen(str)}, pos);
|
}
|
} // namespace caf
|
namespace std {
|
std::ostream& operator<<(std::ostream& out, caf::string_view str) {
|
for (auto ch : str)
|
out.put(ch);
|
return out;
|
}
|
} // namespace std
|
#include <ATen/ATen.h>
|
#include <ATen/NativeFunctions.h>
|
#include <ATen/native/Pool.h>
|
namespace at {
|
namespace meta{
|
using namespace native;
|
TORCH_PRECOMPUTE_META_FUNC(avg_pool2d)
|
(const Tensor& input,
|
IntArrayRef kernel_size,
|
IntArrayRef stride,
|
IntArrayRef padding,
|
bool ceil_mode,
|
bool count_include_pad,
|
c10::optional<int64_t> divisor_override) {
|
// #20866, #22032: Guarantee this for the official C++ API?
|
TORCH_CHECK(kernel_size.size() == 1 || kernel_size.size() == 2,
|
"avg_pool2d: kernel_size must either be a single int, or a tuple of two ints");
|
const int64_t kH = kernel_size[0];
|
const int64_t kW = kernel_size.size() == 1 ? kH : kernel_size[1];
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.