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
list_var = [1, 2, 3] | |
# Same as list_var2 = list(map(lambda x: x+1, list_var)) | |
list_var2 = [elem + 1 for elem in list_var] | |
# same as list_var3 = list(filter(lambda x: x!=1, list_var)) | |
list_var3 = [elem for elem in list_var if elem != 1] |
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
cmake .. \ | |
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I/usr/local/opt/libomp/include" \ | |
-DOpenMP_CXX_LIB_NAMES="omp" \ | |
-DOpenMP_omp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib |
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 tensorflow as tf | |
tf.random.set_seed(20) | |
class Layer(tf.keras.layers.Layer): | |
def __init__(self): | |
super().__init__() | |
self.dense = tf.keras.layers.Dense(20) |
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 tensorflow as tf | |
class TransformerEncoder(tf.keras.layers.Layer): | |
def __init__(self): | |
super().__init__() | |
def call(self, hidden_state): | |
return hidden_state |
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 torch, copy, apex | |
print("initialize model") | |
model_1 = torch.nn.Linear(1000, 2000).cuda() | |
model_2 = torch.nn.Linear(1000, 2000).cuda() | |
model_3 = torch.nn.Linear(1000, 2000).cuda() | |
model_1.weight = torch.nn.Parameter(model_3.weight.clone()) | |
model_2.weight = torch.nn.Parameter(model_3.weight.clone()) |
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
curl "http://localhost:8501/v1/models/test-model:predict" -XPOST -d '{"instances": ["test"]}' | jq |
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
#!/bin/bash | |
# install code deploy agent | |
yum -y update | |
yum install -y ruby | |
cd /home/ec2-user | |
curl -O https://aws-codedeploy-ap-northeast-2.s3.amazonaws.com/latest/install | |
chmod +x ./install | |
./install auto |
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
module piezo( | |
rst, clk, btn, piezo, sseg | |
); | |
input rst, clk; | |
input [7:0] btn; | |
output piezo; | |
output [7:0] sseg; | |
wire piezo; |
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
module counter( | |
rst, cnt, load, | |
cdown, cup, activeLoad, | |
sseg | |
); | |
input rst; | |
input cdown, cup, activeLoad; | |
input [3:0] load; | |
output [3:0] cnt; |
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
module moore(rst, in, out, state); | |
input [1:0] in; | |
input rst; | |
output out; | |
output [1:0] state; | |
reg out; | |
reg [1:0] state; | |
NewerOlder