This file contains 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 <vector> | |
#include <mpi.h> | |
#define DATASIZE(VariableName) std::cout << # VariableName << " " << get_datasize(VariableName) << std::endl; | |
int get_datasize(MPI_Datatype datatype) | |
{ | |
int datasize = 0; | |
MPI_Type_size(datatype, &datasize); |
This file contains 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 heapq import heapify, heappush, heappop, heappushpop | |
def beam_search(root, k, api): | |
""" | |
Args: | |
root : root node | |
k : number of remain paths during search | |
api : apis for beam search | |
Notes: | |
api must have functions as follows. |
This file contains 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 numpy as np | |
## Function | |
def softmax(x): | |
""" | |
Args: | |
x np.array | |
""" | |
if x.ndim == 2: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 Tree import NIL, Node, Tree | |
class RBNode(Node): | |
def __init__(self, value, color): | |
super().__init__(value) | |
self.color = color | |
def __str__(self): | |
s = f'RBNode:\n' | |
s += f' color: {self.color}\n' |
This file contains 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
class NilNode: | |
def __init__(self): | |
self.value = None | |
self.parent = None | |
self.left = None | |
self.right = None | |
NIL = NilNode() | |
class Node: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 <unistd.h> // getopt | |
int main(int argc, char* argv[]) | |
{ | |
int a = 0; | |
int b = 0; | |
bool c = false; |