This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <variant> | |
| #include <memory> | |
| #include <list> | |
| #include <algorithm> | |
| #include <numeric> | |
| struct Shape { | |
| int n_{1}; | |
| int rows_; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import json | |
| import time | |
| import torch | |
| def benchmark_with_warmups(fn, n_warmup: int, n_iter: int) -> float: | |
| for _ in range(n_warmup): | |
| fn() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from itertools import chain | |
| from typing import Optional, Tuple | |
| from torch.utils.data import DataLoader | |
| from transformers import GPT2Tokenizer, GPT2LMHeadModel, GPT2Model, default_data_collator | |
| from transformers.models.gpt2.modeling_gpt2 import GPT2Block | |
| import datasets | |
| from torch import nn | |
| import torch.nn.functional as F | |
| import torch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "a.h" | |
| #include <iostream> | |
| static int _inited = []() -> int { | |
| std::cout << "NS: " << NSFoo() << ", Static: " << StaticFoo() | |
| << ", Inline: " << InlineFoo() << ", Cls: " << Foo::ClsFoo() | |
| << ", Weak: " << WeakSymbFoo() << std::endl; | |
| return 0; | |
| }();⏎ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "async_thread_pool.h" | |
| #include <iostream> | |
| int main() { | |
| TimedThreadWorker worker(std::chrono::milliseconds(1)); | |
| worker.start(); | |
| std::this_thread::sleep_for(std::chrono::seconds(1)); | |
| worker.enqueue(std::chrono::milliseconds(100), | |
| [] { std::cout << "hello" << std::endl; }); | |
| auto fut = worker.enqueue(std::chrono::milliseconds(350), | |
| [] { std::cout << "!" << std::endl; }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| graph G { | |
| A -- B | |
| A -- C | |
| A -- D | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| void PrintRow(size_t N, size_t start, size_t i); | |
| void CyclePrint(size_t N, size_t start=1) { | |
| if (N <= 0) { | |
| return; | |
| } | |
| for (size_t i=0;i<N; ++i) { | |
| PrintRow(N, start, i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| BEGIN_PR_ID=11635 | |
| END_PR_ID=13159 | |
| GH_API_TOKEN=REPLACE_TO_YOUR_API_TOKEN | |
| for ((i=$BEGIN_PR_ID; i<END_PR_ID;++i)) | |
| do | |
| curl -H "Authorization: token $GH_API_TOKEN" https://api.github.com/repos/PaddlePaddle/Paddle/pulls/$i > PR.json | |
| merge_sha1=$(cat PR.json | jq -re .merge_commit_sha) | |
| if [[ $? -eq 1 ]] | |
| then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "ThreadPool.h" | |
| #include <chrono> | |
| #include <iostream> | |
| #include <thread> | |
| #include <vector> | |
| template <size_t HeavySize> class HeavyObject { | |
| public: | |
| HeavyObject() { vec_.resize(HeavySize); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cp_softlink | |
| set realpath (readlink $argv[1]) | |
| rm $argv[1] | |
| cp $realpath $argv[1] | |
| end |
NewerOlder