text
stringlengths 0
2.2M
|
---|
CAF_TEST(bool_vector_size_64) {
|
std::vector<bool> xs;
|
for (int i = 0; i < 64; ++i)
|
xs.push_back(i % 5 == 0);
|
CHECK_EQ(deep_to_string(xs),
|
"[true, false, false, false, false, true, false, false, "
|
"false, false, true, false, false, false, false, true, "
|
"false, false, false, false, true, false, false, false, "
|
"false, true, false, false, false, false, true, false, "
|
"false, false, false, true, false, false, false, false, "
|
"true, false, false, false, false, true, false, false, "
|
"false, false, true, false, false, false, false, true, "
|
"false, false, false, false, true, false, false, false]");
|
CHECK_EQ(xs, roundtrip(xs));
|
CHECK_EQ(xs, msg_roundtrip(xs));
|
}
|
CAF_TEST(bool_vector_size_65) {
|
std::vector<bool> xs;
|
for (int i = 0; i < 65; ++i)
|
xs.push_back(!(i % 7 == 0));
|
CHECK_EQ(
|
deep_to_string(xs),
|
"[false, true, true, true, true, true, true, false, true, true, true, "
|
"true, true, true, false, true, true, true, true, true, true, false, true, "
|
"true, true, true, true, true, false, true, true, true, true, true, true, "
|
"false, true, true, true, true, true, true, false, true, true, true, true, "
|
"true, true, false, true, true, true, true, true, true, false, true, true, "
|
"true, true, true, true, false, true]");
|
CHECK_EQ(xs, roundtrip(xs));
|
CHECK_EQ(xs, msg_roundtrip(xs));
|
}
|
CAF_TEST(serializers handle actor handles) {
|
auto dummy = sys.spawn([]() -> behavior {
|
return {
|
[](int i) { return i; },
|
};
|
});
|
CHECK_EQ(dummy, roundtrip(dummy, false));
|
CHECK_EQ(dummy, msg_roundtrip(dummy));
|
std::vector<strong_actor_ptr> wrapped{actor_cast<strong_actor_ptr>(dummy)};
|
CHECK_EQ(wrapped, roundtrip(wrapped, false));
|
CHECK_EQ(wrapped, msg_roundtrip(wrapped));
|
anon_send_exit(dummy, exit_reason::user_shutdown);
|
}
|
END_FIXTURE_SCOPE()
|
#include <gtest/gtest.h>
|
#include <ATen/ATen.h>
|
#include <c10/core/DispatchKeySet.h>
|
#include <vector>
|
using at::DispatchKey;
|
using at::DispatchKeySet;
|
TEST(DispatchKeySetTest, TestGetRuntimeDispatchKeySet) {
|
// Check if getRuntimeDispatchKeySet and runtimeDispatchKeySetHas agree.
|
for (auto dk1: DispatchKeySet(DispatchKeySet::FULL)) {
|
auto dks = getRuntimeDispatchKeySet(dk1);
|
for (auto dk2: DispatchKeySet(DispatchKeySet::FULL)) {
|
ASSERT_EQ(dks.has(dk2), runtimeDispatchKeySetHas(dk1, dk2));
|
}
|
}
|
}
|
/*
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
*
|
* This source code is licensed under the MIT-style license found in the
|
* LICENSE file in the root directory of this source tree.
|
*/
|
#include "flashlight/lib/audio/feature/Windowing.h"
|
#include <cmath>
|
#include <cstddef>
|
#include <numeric>
|
#include <stdexcept>
|
namespace fl {
|
namespace lib {
|
namespace audio {
|
Windowing::Windowing(int N, WindowType windowtype)
|
: windowLength_(N), windowType_(windowtype), coefs_(N) {
|
if (windowLength_ <= 1) {
|
throw std::invalid_argument("Windowing: windowLength must be > 1");
|
}
|
std::iota(coefs_.begin(), coefs_.end(), 0.0);
|
switch (windowtype) {
|
case WindowType::HAMMING:
|
for (auto& c : coefs_) {
|
c = 0.54 - 0.46 * std::cos(2 * M_PI * c / (N - 1));
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.