In [15]: import copy
In [23]: ax = [[1, 2], [3, 4]]
# deepcopy
In [24]: bx = copy.deepcopy(ax)
In [25]: ax
Out[25]: [[1, 2], [3, 4]]
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
#pragma once | |
#ifdef __INTELLISENSE__ | |
void __syncthreads(); | |
#define KERNEL_ARG2(grid, block) | |
#define KERNEL_ARG3(grid, block, sh_mem) | |
#define KERNEL_ARG4(grid, block, sh_mem, stream) | |
#else | |
#define KERNEL_ARG2(grid, block) <<< grid, block >>> | |
#define KERNEL_ARG3(grid, block, sh_mem) <<< grid, block, sh_mem >>> | |
#define KERNEL_ARG4(grid, block, sh_mem, stream) <<< grid, block, sh_mem, stream >>> |
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
def conv_forward_naive(x, w, b, conv_param): | |
""" | |
A naive implementation of the forward pass for a convolutional layer. | |
The input consists of N data points, each with C channels, height H and | |
width W. We convolve each input with F different filters, where each filter | |
spans all C channels and has height HH and width WW. | |
Input: | |
- x: Input data of shape (N, C, H, W) |
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
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) | |
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). | |
if [ "$PS1" ]; then | |
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then | |
# The file bash.bashrc already sets the default PS1. | |
# PS1='\h:\w\$ ' | |
if [ -f /etc/bash.bashrc ]; then | |
. /etc/bash.bashrc | |
fi |
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
1> block select: | |
##################### | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
asd asd asd asd asd; | |
##################### |
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
import tensorflow as tf | |
# >1 | |
input = [10, 20, 30] | |
ds = tf.data.Dataset.from_tensor_slices(input) | |
ds = ds.flat_map(lambda x: tf.data.Dataset.from_tensor_slices([x, x+1, x+2])) | |
element = ds.make_one_shot_iterator().get_next() |
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 itertools import product | |
import numpy as np | |
# >1 vanilla method, computing expensive | |
def vanilla(initial_prob, trans_prob, obs_prob, observations): | |
it = list((product([0, 1], repeat=len(observations)))) | |
it = np.array(it) | |
# [[0 0 0 0 0] | |
# [0 0 0 0 1] | |
# [0 0 0 1 0] |
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 queue import deque | |
class tree: | |
def __init__(self, x): | |
self.data = x | |
self.left = None | |
self.right = None | |
OlderNewer