Skip to content

Instantly share code, notes, and snippets.

View nariaki3551's full-sized avatar

Nariaki Tateiwa nariaki3551

  • NTT Software Innovation Center
  • Tokyo
View GitHub Profile
#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);
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.
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.
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'
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.
#include <iostream>
#include <unistd.h> // getopt
int main(int argc, char* argv[])
{
int a = 0;
int b = 0;
bool c = false;