repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.half_mag_amplitude_ratio
def half_mag_amplitude_ratio(self, mag, avg, weight): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. ...
python
def half_mag_amplitude_ratio(self, mag, avg, weight): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. ...
[ "def", "half_mag_amplitude_ratio", "(", "self", ",", "mag", ",", "avg", ",", "weight", ")", ":", "# For lower (fainter) magnitude than average.", "index", "=", "np", ".", "where", "(", "mag", ">", "avg", ")", "lower_weight", "=", "weight", "[", "index", "]", ...
Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Parameters ---------- mag : array_like An ar...
[ "Return", "ratio", "of", "amplitude", "of", "higher", "and", "lower", "magnitudes", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L406-L449
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.half_mag_amplitude_ratio2
def half_mag_amplitude_ratio2(self, mag, avg): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Param...
python
def half_mag_amplitude_ratio2(self, mag, avg): """ Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Param...
[ "def", "half_mag_amplitude_ratio2", "(", "self", ",", "mag", ",", "avg", ")", ":", "# For lower (fainter) magnitude than average.", "index", "=", "np", ".", "where", "(", "mag", ">", "avg", ")", "fainter_mag", "=", "mag", "[", "index", "]", "lower_sum", "=", ...
Return ratio of amplitude of higher and lower magnitudes. A ratio of amplitude of higher and lower magnitudes than average, considering weights. This ratio, by definition, should be higher for EB than for others. Parameters ---------- mag : array_like An ar...
[ "Return", "ratio", "of", "amplitude", "of", "higher", "and", "lower", "magnitudes", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L451-L486
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.get_eta
def get_eta(self, mag, std): """ Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of ...
python
def get_eta(self, mag, std): """ Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of ...
[ "def", "get_eta", "(", "self", ",", "mag", ",", "std", ")", ":", "diff", "=", "mag", "[", "1", ":", "]", "-", "mag", "[", ":", "len", "(", "mag", ")", "-", "1", "]", "eta", "=", "np", ".", "sum", "(", "diff", "*", "diff", ")", "/", "(", ...
Return Eta feature. Parameters ---------- mag : array_like An array of magnitudes. std : array_like A standard deviation of magnitudes. Returns ------- eta : float The value of Eta index.
[ "Return", "Eta", "feature", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L488-L508
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.slope_percentile
def slope_percentile(self, date, mag): """ Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Return...
python
def slope_percentile(self, date, mag): """ Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Return...
[ "def", "slope_percentile", "(", "self", ",", "date", ",", "mag", ")", ":", "date_diff", "=", "date", "[", "1", ":", "]", "-", "date", "[", ":", "len", "(", "date", ")", "-", "1", "]", "mag_diff", "=", "mag", "[", "1", ":", "]", "-", "mag", "[...
Return 10% and 90% percentile of slope. Parameters ---------- date : array_like An array of phase-folded date. Sorted. mag : array_like An array of phase-folded magnitudes. Sorted by date. Returns ------- per_10 : float 10% pe...
[ "Return", "10%", "and", "90%", "percentile", "of", "slope", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L510-L543
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.get_cusum
def get_cusum(self, mag): """ Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum. """ c = np.cumsum(mag ...
python
def get_cusum(self, mag): """ Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum. """ c = np.cumsum(mag ...
[ "def", "get_cusum", "(", "self", ",", "mag", ")", ":", "c", "=", "np", ".", "cumsum", "(", "mag", "-", "self", ".", "weighted_mean", ")", "/", "len", "(", "mag", ")", "/", "self", ".", "weighted_std", "return", "np", ".", "max", "(", "c", ")", ...
Return max - min of cumulative sum. Parameters ---------- mag : array_like An array of magnitudes. Returns ------- mm_cusum : float Max - min of cumulative sum.
[ "Return", "max", "-", "min", "of", "cumulative", "sum", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L545-L562
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.get_features2
def get_features2(self): """ Return all features with its names. Returns ------- names : list Feature names. values : list Feature values """ feature_names = [] feature_values = [] # Get all the names of features....
python
def get_features2(self): """ Return all features with its names. Returns ------- names : list Feature names. values : list Feature values """ feature_names = [] feature_values = [] # Get all the names of features....
[ "def", "get_features2", "(", "self", ")", ":", "feature_names", "=", "[", "]", "feature_values", "=", "[", "]", "# Get all the names of features.", "all_vars", "=", "vars", "(", "self", ")", "for", "name", "in", "all_vars", ".", "keys", "(", ")", ":", "# O...
Return all features with its names. Returns ------- names : list Feature names. values : list Feature values
[ "Return", "all", "features", "with", "its", "names", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L564-L600
dwkim78/upsilon
upsilon/extract_features/extract_features.py
ExtractFeatures.get_features_all
def get_features_all(self): """ Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary. """ features = {} # Get all ...
python
def get_features_all(self): """ Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary. """ features = {} # Get all ...
[ "def", "get_features_all", "(", "self", ")", ":", "features", "=", "{", "}", "# Get all the names of features.", "all_vars", "=", "vars", "(", "self", ")", "for", "name", "in", "all_vars", ".", "keys", "(", ")", ":", "if", "name", "in", "feature_names_list_a...
Return all features with its names. Regardless of being used for train and prediction. Sorted by the names. Returns ------- all_features : OrderedDict Features dictionary.
[ "Return", "all", "features", "with", "its", "names", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/extract_features.py#L631-L654
hannes-brt/hebel
hebel/__init__.py
init
def init(device_id=None, random_seed=None): """Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA...
python
def init(device_id=None, random_seed=None): """Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA...
[ "def", "init", "(", "device_id", "=", "None", ",", "random_seed", "=", "None", ")", ":", "if", "device_id", "is", "None", ":", "random_seed", "=", "_os", ".", "environ", ".", "get", "(", "'CUDA_DEVICE'", ")", "if", "random_seed", "is", "None", ":", "ra...
Initialize Hebel. This function creates a CUDA context, CUBLAS context and initializes and seeds the pseudo-random number generator. **Parameters:** device_id : integer, optional The ID of the GPU device to use. If this is omitted, PyCUDA's default context is used, which by defaul...
[ "Initialize", "Hebel", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/__init__.py#L96-L143
rix0rrr/gcl
gcl/ast_util.py
inflate_context_tuple
def inflate_context_tuple(ast_rootpath, root_env): """Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again. """ with util.LogTime('inflate_context_tuple'): # We only need to look at tuple members going down. inflated = ast_rootpath[0].eval(root_env) ...
python
def inflate_context_tuple(ast_rootpath, root_env): """Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again. """ with util.LogTime('inflate_context_tuple'): # We only need to look at tuple members going down. inflated = ast_rootpath[0].eval(root_env) ...
[ "def", "inflate_context_tuple", "(", "ast_rootpath", ",", "root_env", ")", ":", "with", "util", ".", "LogTime", "(", "'inflate_context_tuple'", ")", ":", "# We only need to look at tuple members going down.", "inflated", "=", "ast_rootpath", "[", "0", "]", ".", "eval"...
Instantiate a Tuple from a TupleNode. Walking the AST tree upwards, evaluate from the root down again.
[ "Instantiate", "a", "Tuple", "from", "a", "TupleNode", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L24-L52
rix0rrr/gcl
gcl/ast_util.py
enumerate_scope
def enumerate_scope(ast_rootpath, root_env=None, include_default_builtins=False): """Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in. """ with util.LogTime('enu...
python
def enumerate_scope(ast_rootpath, root_env=None, include_default_builtins=False): """Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in. """ with util.LogTime('enu...
[ "def", "enumerate_scope", "(", "ast_rootpath", ",", "root_env", "=", "None", ",", "include_default_builtins", "=", "False", ")", ":", "with", "util", ".", "LogTime", "(", "'enumerate_scope'", ")", ":", "scope", "=", "{", "}", "for", "node", "in", "reversed",...
Return a dict of { name => Completions } for the given tuple node. Enumerates all keys that are in scope in a given tuple. The node part of the tuple may be None, in case the binding is a built-in.
[ "Return", "a", "dict", "of", "{", "name", "=", ">", "Completions", "}", "for", "the", "given", "tuple", "node", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L75-L98
rix0rrr/gcl
gcl/ast_util.py
find_deref_completions
def find_deref_completions(ast_rootpath, root_env=gcl.default_env): """Returns a dict of { name => Completions }.""" with util.LogTime('find_deref_completions'): tup = inflate_context_tuple(ast_rootpath, root_env) path = path_until(ast_rootpath, is_deref_node) if not path: return {} deref = pa...
python
def find_deref_completions(ast_rootpath, root_env=gcl.default_env): """Returns a dict of { name => Completions }.""" with util.LogTime('find_deref_completions'): tup = inflate_context_tuple(ast_rootpath, root_env) path = path_until(ast_rootpath, is_deref_node) if not path: return {} deref = pa...
[ "def", "find_deref_completions", "(", "ast_rootpath", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "with", "util", ".", "LogTime", "(", "'find_deref_completions'", ")", ":", "tup", "=", "inflate_context_tuple", "(", "ast_rootpath", ",", "root_env", ...
Returns a dict of { name => Completions }.
[ "Returns", "a", "dict", "of", "{", "name", "=", ">", "Completions", "}", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L122-L133
rix0rrr/gcl
gcl/ast_util.py
is_identifier_position
def is_identifier_position(rootpath): """Return whether the cursor is in identifier-position in a member declaration.""" if len(rootpath) >= 2 and is_tuple_member_node(rootpath[-2]) and is_identifier(rootpath[-1]): return True if len(rootpath) >= 1 and is_tuple_node(rootpath[-1]): # No deeper node than tu...
python
def is_identifier_position(rootpath): """Return whether the cursor is in identifier-position in a member declaration.""" if len(rootpath) >= 2 and is_tuple_member_node(rootpath[-2]) and is_identifier(rootpath[-1]): return True if len(rootpath) >= 1 and is_tuple_node(rootpath[-1]): # No deeper node than tu...
[ "def", "is_identifier_position", "(", "rootpath", ")", ":", "if", "len", "(", "rootpath", ")", ">=", "2", "and", "is_tuple_member_node", "(", "rootpath", "[", "-", "2", "]", ")", "and", "is_identifier", "(", "rootpath", "[", "-", "1", "]", ")", ":", "r...
Return whether the cursor is in identifier-position in a member declaration.
[ "Return", "whether", "the", "cursor", "is", "in", "identifier", "-", "position", "in", "a", "member", "declaration", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L141-L148
rix0rrr/gcl
gcl/ast_util.py
find_completions_at_cursor
def find_completions_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find completions at the cursor. Return a dict of { name => Completion } objects. """ q = gcl.SourceQuery(filename, line, col - 1) rootpath = ast_tree.find_tokens(q) if is_identifier_position(rootpath): return f...
python
def find_completions_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find completions at the cursor. Return a dict of { name => Completion } objects. """ q = gcl.SourceQuery(filename, line, col - 1) rootpath = ast_tree.find_tokens(q) if is_identifier_position(rootpath): return f...
[ "def", "find_completions_at_cursor", "(", "ast_tree", ",", "filename", ",", "line", ",", "col", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "q", "=", "gcl", ".", "SourceQuery", "(", "filename", ",", "line", ",", "col", "-", "1", ")", "ro...
Find completions at the cursor. Return a dict of { name => Completion } objects.
[ "Find", "completions", "at", "the", "cursor", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L151-L168
rix0rrr/gcl
gcl/ast_util.py
find_inherited_key_completions
def find_inherited_key_completions(rootpath, root_env): """Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple. """ tup = inflate_context_tuple(rootpath, root_env) if is...
python
def find_inherited_key_completions(rootpath, root_env): """Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple. """ tup = inflate_context_tuple(rootpath, root_env) if is...
[ "def", "find_inherited_key_completions", "(", "rootpath", ",", "root_env", ")", ":", "tup", "=", "inflate_context_tuple", "(", "rootpath", ",", "root_env", ")", "if", "isinstance", "(", "tup", ",", "runtime", ".", "CompositeTuple", ")", ":", "keys", "=", "set"...
Return completion keys from INHERITED tuples. Easiest way to get those is to evaluate the tuple, check if it is a CompositeTuple, then enumerate the keys that are NOT in the rightmost tuple.
[ "Return", "completion", "keys", "from", "INHERITED", "tuples", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L171-L181
rix0rrr/gcl
gcl/ast_util.py
find_value_at_cursor
def find_value_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find the value of the object under the cursor.""" q = gcl.SourceQuery(filename, line, col) rootpath = ast_tree.find_tokens(q) rootpath = path_until(rootpath, is_thunk) if len(rootpath) <= 1: # Just the file tuple itself...
python
def find_value_at_cursor(ast_tree, filename, line, col, root_env=gcl.default_env): """Find the value of the object under the cursor.""" q = gcl.SourceQuery(filename, line, col) rootpath = ast_tree.find_tokens(q) rootpath = path_until(rootpath, is_thunk) if len(rootpath) <= 1: # Just the file tuple itself...
[ "def", "find_value_at_cursor", "(", "ast_tree", ",", "filename", ",", "line", ",", "col", ",", "root_env", "=", "gcl", ".", "default_env", ")", ":", "q", "=", "gcl", ".", "SourceQuery", "(", "filename", ",", "line", ",", "col", ")", "rootpath", "=", "a...
Find the value of the object under the cursor.
[ "Find", "the", "value", "of", "the", "object", "under", "the", "cursor", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast_util.py#L184-L202
hannes-brt/hebel
hebel/pycuda_ops/matrix.py
add_vec_to_mat
def add_vec_to_mat(mat, vec, axis=None, inplace=False, target=None, substract=False): """ Add a vector to a matrix """ assert mat.flags.c_contiguous if axis is None: if vec.shape[0] == mat.shape[0]: axis = 0 elif vec.shape[0] == mat.shape[1]: ...
python
def add_vec_to_mat(mat, vec, axis=None, inplace=False, target=None, substract=False): """ Add a vector to a matrix """ assert mat.flags.c_contiguous if axis is None: if vec.shape[0] == mat.shape[0]: axis = 0 elif vec.shape[0] == mat.shape[1]: ...
[ "def", "add_vec_to_mat", "(", "mat", ",", "vec", ",", "axis", "=", "None", ",", "inplace", "=", "False", ",", "target", "=", "None", ",", "substract", "=", "False", ")", ":", "assert", "mat", ".", "flags", ".", "c_contiguous", "if", "axis", "is", "No...
Add a vector to a matrix
[ "Add", "a", "vector", "to", "a", "matrix" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/matrix.py#L130-L179
hannes-brt/hebel
hebel/pycuda_ops/matrix.py
vector_normalize
def vector_normalize(mat, max_vec_norm=1.): """ Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm """ assert mat.flags.c_contiguous n, m = mat.shape vector_normalize_kernel.prepared_call( (m, 1, 1), (32, 1, 1), mat.gpudata, np.f...
python
def vector_normalize(mat, max_vec_norm=1.): """ Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm """ assert mat.flags.c_contiguous n, m = mat.shape vector_normalize_kernel.prepared_call( (m, 1, 1), (32, 1, 1), mat.gpudata, np.f...
[ "def", "vector_normalize", "(", "mat", ",", "max_vec_norm", "=", "1.", ")", ":", "assert", "mat", ".", "flags", ".", "c_contiguous", "n", ",", "m", "=", "mat", ".", "shape", "vector_normalize_kernel", ".", "prepared_call", "(", "(", "m", ",", "1", ",", ...
Normalize each column vector in mat to length max_vec_norm if it is longer than max_vec_norm
[ "Normalize", "each", "column", "vector", "in", "mat", "to", "length", "max_vec_norm", "if", "it", "is", "longer", "than", "max_vec_norm" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/matrix.py#L182-L194
hannes-brt/hebel
hebel/utils/string_utils.py
preprocess
def preprocess(string): """ Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string """ split = string.split('${') rval = [split[0]] for candidate...
python
def preprocess(string): """ Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string """ split = string.split('${') rval = [split[0]] for candidate...
[ "def", "preprocess", "(", "string", ")", ":", "split", "=", "string", ".", "split", "(", "'${'", ")", "rval", "=", "[", "split", "[", "0", "]", "]", "for", "candidate", "in", "split", "[", "1", ":", "]", ":", "subsplit", "=", "candidate", ".", "s...
Preprocesses a string, by replacing ${VARNAME} with os.environ['VARNAME'] Parameters ---------- string: the str object to preprocess Returns ------- the preprocessed string
[ "Preprocesses", "a", "string", "by", "replacing", "$", "{", "VARNAME", "}", "with", "os", ".", "environ", "[", "VARNAME", "]" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L26-L77
hannes-brt/hebel
hebel/utils/string_utils.py
tokenize_by_number
def tokenize_by_number(s): """ splits a string into a list of tokens each is either a string containing no numbers or a float """ r = find_number(s) if r == None: return [ s ] else: tokens = [] if r[0] > 0: tokens.append(s[0:r[0]]) tokens.app...
python
def tokenize_by_number(s): """ splits a string into a list of tokens each is either a string containing no numbers or a float """ r = find_number(s) if r == None: return [ s ] else: tokens = [] if r[0] > 0: tokens.append(s[0:r[0]]) tokens.app...
[ "def", "tokenize_by_number", "(", "s", ")", ":", "r", "=", "find_number", "(", "s", ")", "if", "r", "==", "None", ":", "return", "[", "s", "]", "else", ":", "tokens", "=", "[", "]", "if", "r", "[", "0", "]", ">", "0", ":", "tokens", ".", "app...
splits a string into a list of tokens each is either a string containing no numbers or a float
[ "splits", "a", "string", "into", "a", "list", "of", "tokens", "each", "is", "either", "a", "string", "containing", "no", "numbers", "or", "a", "float" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L93-L110
hannes-brt/hebel
hebel/utils/string_utils.py
number_aware_alphabetical_cmp
def number_aware_alphabetical_cmp(str1, str2): """ cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10 """ def flatten_tokens(tokens): l = [] for token in tokens...
python
def number_aware_alphabetical_cmp(str1, str2): """ cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10 """ def flatten_tokens(tokens): l = [] for token in tokens...
[ "def", "number_aware_alphabetical_cmp", "(", "str1", ",", "str2", ")", ":", "def", "flatten_tokens", "(", "tokens", ")", ":", "l", "=", "[", "]", "for", "token", "in", "tokens", ":", "if", "isinstance", "(", "token", ",", "str", ")", ":", "for", "char"...
cmp function for sorting a list of strings by alphabetical order, but with numbers sorted numerically. i.e., foo1, foo2, foo10, foo11 instead of foo1, foo10
[ "cmp", "function", "for", "sorting", "a", "list", "of", "strings", "by", "alphabetical", "order", "but", "with", "numbers", "sorted", "numerically", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L113-L151
hannes-brt/hebel
hebel/utils/string_utils.py
match
def match(wrong, candidates): """ wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filen...
python
def match(wrong, candidates): """ wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filen...
[ "def", "match", "(", "wrong", ",", "candidates", ")", ":", "assert", "len", "(", "candidates", ")", ">", "0", "# Current implementation tries all candidates and outputs the one", "# with the min score", "# Could try to do something smarter", "def", "score", "(", "w1", ","...
wrong: a mispelling candidates: a set of correct words returns a guess of which candidate is the right one This should be used with a small number of candidates and a high potential edit distance. ie, use it to correct a wrong filename in a directory, wrong class name i...
[ "wrong", ":", "a", "mispelling", "candidates", ":", "a", "set", "of", "correct", "words" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L153-L219
hannes-brt/hebel
hebel/utils/string_utils.py
censor_non_alphanum
def censor_non_alphanum(s): """ Returns s with all non-alphanumeric characters replaced with * """ def censor(ch): if (ch >= 'A' and ch <= 'z') or (ch >= '0' and ch <= '9'): return ch return '*' return ''.join([censor(ch) for ch in s])
python
def censor_non_alphanum(s): """ Returns s with all non-alphanumeric characters replaced with * """ def censor(ch): if (ch >= 'A' and ch <= 'z') or (ch >= '0' and ch <= '9'): return ch return '*' return ''.join([censor(ch) for ch in s])
[ "def", "censor_non_alphanum", "(", "s", ")", ":", "def", "censor", "(", "ch", ")", ":", "if", "(", "ch", ">=", "'A'", "and", "ch", "<=", "'z'", ")", "or", "(", "ch", ">=", "'0'", "and", "ch", "<=", "'9'", ")", ":", "return", "ch", "return", "'*...
Returns s with all non-alphanumeric characters replaced with *
[ "Returns", "s", "with", "all", "non", "-", "alphanumeric", "characters", "replaced", "with", "*" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/string_utils.py#L221-L231
dwkim78/upsilon
upsilon/extract_features/is_period_alias.py
is_period_alias
def is_period_alias(period): """ Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias. """ ...
python
def is_period_alias(period): """ Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias. """ ...
[ "def", "is_period_alias", "(", "period", ")", ":", "# Based on the period vs periodSN plot of EROS-2 dataset (Kim+ 2014).", "# Period alias occurs mostly at ~1 and ~30.", "# Check each 1, 2, 3, 4, 5 factors.", "for", "i", "in", "range", "(", "1", ",", "6", ")", ":", "# One-day ...
Check if a given period is possibly an alias. Parameters ---------- period : float A period to test if it is a possible alias or not. Returns ------- is_alias : boolean True if the given period is in a range of period alias.
[ "Check", "if", "a", "given", "period", "is", "possibly", "an", "alias", "." ]
train
https://github.com/dwkim78/upsilon/blob/5f381453f26582ef56e62fb8fed7317ce67861af/upsilon/extract_features/is_period_alias.py#L1-L57
hannes-brt/hebel
hebel/utils/serial.py
save
def save(filepath, obj, on_overwrite = 'ignore'): """ Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms...
python
def save(filepath, obj, on_overwrite = 'ignore'): """ Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms...
[ "def", "save", "(", "filepath", ",", "obj", ",", "on_overwrite", "=", "'ignore'", ")", ":", "filepath", "=", "preprocess", "(", "filepath", ")", "if", "os", ".", "path", ".", "exists", "(", "filepath", ")", ":", "if", "on_overwrite", "==", "'backup'", ...
Serialize `object` to a file denoted by `filepath`. Parameters ---------- filepath : str A filename. If the suffix is `.joblib` and joblib can be imported, `joblib.dump` is used in place of the regular pickling mechanisms; this results in much faster saves by saving arrays a...
[ "Serialize", "object", "to", "a", "file", "denoted", "by", "filepath", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L177-L245
hannes-brt/hebel
hebel/utils/serial.py
get_pickle_protocol
def get_pickle_protocol(): """ Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to com...
python
def get_pickle_protocol(): """ Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to com...
[ "def", "get_pickle_protocol", "(", ")", ":", "try", ":", "protocol_str", "=", "os", ".", "environ", "[", "'PYLEARN2_PICKLE_PROTOCOL'", "]", "except", "KeyError", ":", "# If not defined, we default to 0 because this is the default", "# protocol used by cPickle.dump (and because ...
Allow configuration of the pickle protocol on a per-machine basis. This way, if you use multiple platforms with different versions of pickle, you can configure each of them to use the highest protocol supported by all of the machines that you want to be able to communicate.
[ "Allow", "configuration", "of", "the", "pickle", "protocol", "on", "a", "per", "-", "machine", "basis", ".", "This", "way", "if", "you", "use", "multiple", "platforms", "with", "different", "versions", "of", "pickle", "you", "can", "configure", "each", "of",...
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L248-L265
hannes-brt/hebel
hebel/utils/serial.py
load_train_file
def load_train_file(config_file_path): """Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables""" from pylearn2.config import yaml_parse suffix_to_strip = '.yaml' # publish environment variables related to file name if config_file_path.endswith...
python
def load_train_file(config_file_path): """Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables""" from pylearn2.config import yaml_parse suffix_to_strip = '.yaml' # publish environment variables related to file name if config_file_path.endswith...
[ "def", "load_train_file", "(", "config_file_path", ")", ":", "from", "pylearn2", ".", "config", "import", "yaml_parse", "suffix_to_strip", "=", "'.yaml'", "# publish environment variables related to file name", "if", "config_file_path", ".", "endswith", "(", "suffix_to_stri...
Loads and parses a yaml file for a Train object. Publishes the relevant training environment variables
[ "Loads", "and", "parses", "a", "yaml", "file", "for", "a", "Train", "object", ".", "Publishes", "the", "relevant", "training", "environment", "variables" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/utils/serial.py#L426-L451
hannes-brt/hebel
hebel/layers/input_dropout.py
InputDropout.feed_forward
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is ...
python
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is ...
[ "def", "feed_forward", "(", "self", ",", "input_data", ",", "prediction", "=", "False", ")", ":", "if", "input_data", ".", "shape", "[", "1", "]", "!=", "self", ".", "n_in", ":", "raise", "ValueError", "(", "'Number of outputs from previous layer (%d) '", "'do...
Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. prediction : bool, optional Whether to use prediction model. If true, then the data is scaled by ``1 - dropout_probability`` uses dropout. ...
[ "Propagate", "forward", "through", "the", "layer" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/input_dropout.py#L59-L89
hannes-brt/hebel
hebel/layers/input_dropout.py
InputDropout.backprop
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer ...
python
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer ...
[ "def", "backprop", "(", "self", ",", "input_data", ",", "df_output", ",", "cache", "=", "None", ")", ":", "if", "self", ".", "compute_input_gradients", ":", "apply_dropout_mask", "(", "df_output", ",", "dropout_mask", ")", "return", "tuple", "(", ")", ",", ...
Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Inpute data to perform dropout on. df_output : ``GPUArray`` Gradients with respect to the output of this layer (received from the layer above). cache : list of ``GPUAr...
[ "Backpropagate", "through", "the", "hidden", "layer" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/input_dropout.py#L91-L119
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
POINTER
def POINTER(obj): """ Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms. """ p = ctypes.POINTER(obj) if not isinstance(p.from_param, classmethod): def from_param(cls...
python
def POINTER(obj): """ Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms. """ p = ctypes.POINTER(obj) if not isinstance(p.from_param, classmethod): def from_param(cls...
[ "def", "POINTER", "(", "obj", ")", ":", "p", "=", "ctypes", ".", "POINTER", "(", "obj", ")", "if", "not", "isinstance", "(", "p", ".", "from_param", ",", "classmethod", ")", ":", "def", "from_param", "(", "cls", ",", "x", ")", ":", "if", "x", "is...
Create ctypes pointer to object. Notes ----- This function converts None to a real NULL pointer because of bug in how ctypes handles None on 64-bit platforms.
[ "Create", "ctypes", "pointer", "to", "object", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L63-L83
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
gpuarray_ptr
def gpuarray_ptr(g): """ Return ctypes pointer to data in GPUAarray object. """ addr = int(g.gpudata) if g.dtype == np.int8: return ctypes.cast(addr, POINTER(ctypes.c_byte)) if g.dtype == np.uint8: return ctypes.cast(addr, POINTER(ctypes.c_ubyte)) if g.dtype == np.int16: ...
python
def gpuarray_ptr(g): """ Return ctypes pointer to data in GPUAarray object. """ addr = int(g.gpudata) if g.dtype == np.int8: return ctypes.cast(addr, POINTER(ctypes.c_byte)) if g.dtype == np.uint8: return ctypes.cast(addr, POINTER(ctypes.c_ubyte)) if g.dtype == np.int16: ...
[ "def", "gpuarray_ptr", "(", "g", ")", ":", "addr", "=", "int", "(", "g", ".", "gpudata", ")", "if", "g", ".", "dtype", "==", "np", ".", "int8", ":", "return", "ctypes", ".", "cast", "(", "addr", ",", "POINTER", "(", "ctypes", ".", "c_byte", ")", ...
Return ctypes pointer to data in GPUAarray object.
[ "Return", "ctypes", "pointer", "to", "data", "in", "GPUAarray", "object", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L108-L140
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaMalloc
def cudaMalloc(count, ctype=None): """ Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast retu...
python
def cudaMalloc(count, ctype=None): """ Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast retu...
[ "def", "cudaMalloc", "(", "count", ",", "ctype", "=", "None", ")", ":", "ptr", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudart", ".", "cudaMalloc", "(", "ctypes", ".", "byref", "(", "ptr", ")", ",", "count", ")", "cudaCheckStatus",...
Allocate device memory. Allocate memory on the device associated with the current active context. Parameters ---------- count : int Number of bytes of memory to allocate ctype : _ctypes.SimpleType, optional ctypes type to cast returned pointer. Returns ------- ptr ...
[ "Allocate", "device", "memory", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L485-L511
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaMallocPitch
def cudaMallocPitch(pitch, rows, cols, elesize): """ Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height....
python
def cudaMallocPitch(pitch, rows, cols, elesize): """ Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height....
[ "def", "cudaMallocPitch", "(", "pitch", ",", "rows", ",", "cols", ",", "elesize", ")", ":", "ptr", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcudart", ".", "cudaMallocPitch", "(", "ctypes", ".", "byref", "(", "ptr", ")", ",", "ctypes...
Allocate pitched device memory. Allocate pitched memory on the device associated with the current active context. Parameters ---------- pitch : int Pitch for allocation. rows : int Requested pitched allocation height. cols : int Requested pitched allocation width. ...
[ "Allocate", "pitched", "device", "memory", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L536-L566
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaMemcpy_htod
def cudaMemcpy_htod(dst, src, count): """ Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to cop...
python
def cudaMemcpy_htod(dst, src, count): """ Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to cop...
[ "def", "cudaMemcpy_htod", "(", "dst", ",", "src", ",", "count", ")", ":", "status", "=", "_libcudart", ".", "cudaMemcpy", "(", "dst", ",", "src", ",", "ctypes", ".", "c_size_t", "(", "count", ")", ",", "cudaMemcpyHostToDevice", ")", "cudaCheckStatus", "(",...
Copy memory from host to device. Copy data from host memory to device memory. Parameters ---------- dst : ctypes pointer Device memory pointer. src : ctypes pointer Host memory pointer. count : int Number of bytes to copy.
[ "Copy", "memory", "from", "host", "to", "device", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L578-L598
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaMemcpy_dtoh
def cudaMemcpy_dtoh(dst, src, count): """ Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to cop...
python
def cudaMemcpy_dtoh(dst, src, count): """ Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to cop...
[ "def", "cudaMemcpy_dtoh", "(", "dst", ",", "src", ",", "count", ")", ":", "status", "=", "_libcudart", ".", "cudaMemcpy", "(", "dst", ",", "src", ",", "ctypes", ".", "c_size_t", "(", "count", ")", ",", "cudaMemcpyDeviceToHost", ")", "cudaCheckStatus", "(",...
Copy memory from device to host. Copy data from device memory to host memory. Parameters ---------- dst : ctypes pointer Host memory pointer. src : ctypes pointer Device memory pointer. count : int Number of bytes to copy.
[ "Copy", "memory", "from", "device", "to", "host", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L600-L620
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaMemGetInfo
def cudaMemGetInfo(): """ Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes. """ free = ctypes.c_size_t() total = ctypes.c_size_t() status = _libcudart.cudaMemGetInfo(ctypes.b...
python
def cudaMemGetInfo(): """ Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes. """ free = ctypes.c_size_t() total = ctypes.c_size_t() status = _libcudart.cudaMemGetInfo(ctypes.b...
[ "def", "cudaMemGetInfo", "(", ")", ":", "free", "=", "ctypes", ".", "c_size_t", "(", ")", "total", "=", "ctypes", ".", "c_size_t", "(", ")", "status", "=", "_libcudart", ".", "cudaMemGetInfo", "(", "ctypes", ".", "byref", "(", "free", ")", ",", "ctypes...
Return the amount of free and total device memory. Returns ------- free : long Free memory in bytes. total : long Total memory in bytes.
[ "Return", "the", "amount", "of", "free", "and", "total", "device", "memory", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L625-L643
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaGetDevice
def cudaGetDevice(): """ Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number. """ dev = ctypes.c_int() status = _libcudart.cudaGetDevice(ctypes.byref(dev)) cudaChec...
python
def cudaGetDevice(): """ Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number. """ dev = ctypes.c_int() status = _libcudart.cudaGetDevice(ctypes.byref(dev)) cudaChec...
[ "def", "cudaGetDevice", "(", ")", ":", "dev", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudart", ".", "cudaGetDevice", "(", "ctypes", ".", "byref", "(", "dev", ")", ")", "cudaCheckStatus", "(", "status", ")", "return", "dev", ".", "val...
Get current CUDA device. Return the identifying number of the device currently used to process CUDA operations. Returns ------- dev : int Device number.
[ "Get", "current", "CUDA", "device", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L665-L682
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaDriverGetVersion
def cudaDriverGetVersion(): """ Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version. """ version = ctypes.c_int() status = _libcudart.cu...
python
def cudaDriverGetVersion(): """ Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version. """ version = ctypes.c_int() status = _libcudart.cu...
[ "def", "cudaDriverGetVersion", "(", ")", ":", "version", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcudart", ".", "cudaDriverGetVersion", "(", "ctypes", ".", "byref", "(", "version", ")", ")", "cudaCheckStatus", "(", "status", ")", "return", ...
Get installed CUDA driver version. Return the version of the installed CUDA driver as an integer. If no driver is detected, 0 is returned. Returns ------- version : int Driver version.
[ "Get", "installed", "CUDA", "driver", "version", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L686-L703
hannes-brt/hebel
hebel/pycuda_ops/cudart.py
cudaPointerGetAttributes
def cudaPointerGetAttributes(ptr): """ Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indica...
python
def cudaPointerGetAttributes(ptr): """ Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indica...
[ "def", "cudaPointerGetAttributes", "(", "ptr", ")", ":", "attributes", "=", "cudaPointerAttributes", "(", ")", "status", "=", "_libcudart", ".", "cudaPointerGetAttributes", "(", "ctypes", ".", "byref", "(", "attributes", ")", ",", "ptr", ")", "cudaCheckStatus", ...
Get memory pointer attributes. Returns attributes of the specified pointer. Parameters ---------- ptr : ctypes pointer Memory pointer to examine. Returns ------- memory_type : int Memory type; 1 indicates host memory, 2 indicates device memory. device : int ...
[ "Get", "memory", "pointer", "attributes", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cudart.py#L720-L749
rix0rrr/gcl
gcl/framework.py
eval
def eval(thunk, env): """Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __get...
python
def eval(thunk, env): """Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __get...
[ "def", "eval", "(", "thunk", ",", "env", ")", ":", "key", "=", "Activation", ".", "key", "(", "thunk", ",", "env", ")", "if", "Activation", ".", "activated", "(", "key", ")", ":", "raise", "exceptions", ".", "RecursionError", "(", "'Reference cycle'", ...
Evaluate a thunk in an environment. Will defer the actual evaluation to the thunk itself, but adds two things: caching and recursion detection. Since we have to use a global evaluation stack (because there is a variety of functions that may be invoked, not just eval() but also __getitem__, and not all of them...
[ "Evaluate", "a", "thunk", "in", "an", "environment", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/framework.py#L30-L55
rix0rrr/gcl
gcl/framework.py
Environment.get_node
def get_node(self, key): """Delegate to our current "value provider" for the node belonging to this key.""" if key in self.names: return self.values.get_member_node(key) if hasattr(self.values, 'get_member_node') else None return self.parent.get_node(key)
python
def get_node(self, key): """Delegate to our current "value provider" for the node belonging to this key.""" if key in self.names: return self.values.get_member_node(key) if hasattr(self.values, 'get_member_node') else None return self.parent.get_node(key)
[ "def", "get_node", "(", "self", ",", "key", ")", ":", "if", "key", "in", "self", ".", "names", ":", "return", "self", ".", "values", ".", "get_member_node", "(", "key", ")", "if", "hasattr", "(", "self", ".", "values", ",", "'get_member_node'", ")", ...
Delegate to our current "value provider" for the node belonging to this key.
[ "Delegate", "to", "our", "current", "value", "provider", "for", "the", "node", "belonging", "to", "this", "key", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/framework.py#L170-L174
erm0l0v/django-fake-model
django_fake_model/models.py
FakeModel.create_table
def create_table(cls): """ create_table Manually create a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with schema_editor() as schema_editor: sch...
python
def create_table(cls): """ create_table Manually create a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with schema_editor() as schema_editor: sch...
[ "def", "create_table", "(", "cls", ")", ":", "schema_editor", "=", "getattr", "(", "connection", ",", "'schema_editor'", ",", "None", ")", "if", "schema_editor", ":", "with", "schema_editor", "(", ")", "as", "schema_editor", ":", "schema_editor", ".", "create_...
create_table Manually create a temporary table for model in test data base. :return:
[ "create_table" ]
train
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L22-L43
erm0l0v/django-fake-model
django_fake_model/models.py
FakeModel.delete_table
def delete_table(cls): """ delete_table Manually delete a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with connection.schema_editor() as schema_editor: ...
python
def delete_table(cls): """ delete_table Manually delete a temporary table for model in test data base. :return: """ schema_editor = getattr(connection, 'schema_editor', None) if schema_editor: with connection.schema_editor() as schema_editor: ...
[ "def", "delete_table", "(", "cls", ")", ":", "schema_editor", "=", "getattr", "(", "connection", ",", "'schema_editor'", ",", "None", ")", "if", "schema_editor", ":", "with", "connection", ".", "schema_editor", "(", ")", "as", "schema_editor", ":", "schema_edi...
delete_table Manually delete a temporary table for model in test data base. :return:
[ "delete_table" ]
train
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L46-L64
erm0l0v/django-fake-model
django_fake_model/models.py
FakeModel.fake_me
def fake_me(cls, source): """ fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return: ...
python
def fake_me(cls, source): """ fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return: ...
[ "def", "fake_me", "(", "cls", ",", "source", ")", ":", "if", "source", "and", "type", "(", "source", ")", "==", "type", "and", "issubclass", "(", "source", ",", "SimpleTestCase", ")", ":", "return", "cls", ".", "_class_extension", "(", "source", ")", "...
fake_me Class or method decorator Class decorator: create temporary table for all tests in SimpleTestCase. Method decorator: create temporary model only for given test method. :param source: SimpleTestCase or test function :return:
[ "fake_me" ]
train
https://github.com/erm0l0v/django-fake-model/blob/42fb28ac3aa4db5f82b6cb97a7c2a92b83b36314/django_fake_model/models.py#L67-L83
obspy/vcr
vcr/core.py
vcr
def vcr(decorated_func=None, debug=False, overwrite=False, disabled=False, playback_only=False, tape_name=None): """ Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recordi...
python
def vcr(decorated_func=None, debug=False, overwrite=False, disabled=False, playback_only=False, tape_name=None): """ Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recordi...
[ "def", "vcr", "(", "decorated_func", "=", "None", ",", "debug", "=", "False", ",", "overwrite", "=", "False", ",", "disabled", "=", "False", ",", "playback_only", "=", "False", ",", "tape_name", "=", "None", ")", ":", "def", "_vcr_outer", "(", "func", ...
Decorator for capturing and simulating network communication ``debug`` : bool, optional Enables debug mode. ``overwrite`` : bool, optional Will run vcr in recording mode - overwrites any existing vcrtapes. ``playback_only`` : bool, optional Will run vcr in playback mode - will not c...
[ "Decorator", "for", "capturing", "and", "simulating", "network", "communication" ]
train
https://github.com/obspy/vcr/blob/f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6/vcr/core.py#L413-L555
obspy/vcr
vcr/core.py
VCRSystem.reset
def reset(cls): """ Reset to default settings """ cls.debug = False cls.disabled = False cls.overwrite = False cls.playback_only = False cls.recv_timeout = 5 cls.recv_endmarkers = [] cls.recv_size = None
python
def reset(cls): """ Reset to default settings """ cls.debug = False cls.disabled = False cls.overwrite = False cls.playback_only = False cls.recv_timeout = 5 cls.recv_endmarkers = [] cls.recv_size = None
[ "def", "reset", "(", "cls", ")", ":", "cls", ".", "debug", "=", "False", "cls", ".", "disabled", "=", "False", "cls", ".", "overwrite", "=", "False", "cls", ".", "playback_only", "=", "False", "cls", ".", "recv_timeout", "=", "5", "cls", ".", "recv_e...
Reset to default settings
[ "Reset", "to", "default", "settings" ]
train
https://github.com/obspy/vcr/blob/f961d3bffc57d1761b6de2fb1e67d5f464ebc6b6/vcr/core.py#L112-L122
rix0rrr/gcl
gcl/util.py
to_python
def to_python(value, seen=None): """Reify values to their Python equivalents. Does recursion detection, failing when that happens. """ seen = seen or set() if isinstance(value, framework.TupleLike): if value.ident in seen: raise RecursionException('to_python: infinite recursion while evaluating %r'...
python
def to_python(value, seen=None): """Reify values to their Python equivalents. Does recursion detection, failing when that happens. """ seen = seen or set() if isinstance(value, framework.TupleLike): if value.ident in seen: raise RecursionException('to_python: infinite recursion while evaluating %r'...
[ "def", "to_python", "(", "value", ",", "seen", "=", "None", ")", ":", "seen", "=", "seen", "or", "set", "(", ")", "if", "isinstance", "(", "value", ",", "framework", ".", "TupleLike", ")", ":", "if", "value", ".", "ident", "in", "seen", ":", "raise...
Reify values to their Python equivalents. Does recursion detection, failing when that happens.
[ "Reify", "values", "to", "their", "Python", "equivalents", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/util.py#L81-L96
rix0rrr/gcl
gcl/util.py
walk
def walk(value, walker, path=None, seen=None): """Walks the _evaluated_ tree of the given GCL tuple. The appropriate methods of walker will be invoked for every element in the tree. """ seen = seen or set() path = path or [] # Recursion if id(value) in seen: walker.visitRecursion(path) return ...
python
def walk(value, walker, path=None, seen=None): """Walks the _evaluated_ tree of the given GCL tuple. The appropriate methods of walker will be invoked for every element in the tree. """ seen = seen or set() path = path or [] # Recursion if id(value) in seen: walker.visitRecursion(path) return ...
[ "def", "walk", "(", "value", ",", "walker", ",", "path", "=", "None", ",", "seen", "=", "None", ")", ":", "seen", "=", "seen", "or", "set", "(", ")", "path", "=", "path", "or", "[", "]", "# Recursion", "if", "id", "(", "value", ")", "in", "seen...
Walks the _evaluated_ tree of the given GCL tuple. The appropriate methods of walker will be invoked for every element in the tree.
[ "Walks", "the", "_evaluated_", "tree", "of", "the", "given", "GCL", "tuple", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/util.py#L99-L149
rix0rrr/gcl
gcl/util.py
fingerprint
def fingerprint(value): """Return a hash value that uniquely identifies the GCL value.""" h = hashlib.sha256() _digest(value, h) return h.digest().encode('hex')
python
def fingerprint(value): """Return a hash value that uniquely identifies the GCL value.""" h = hashlib.sha256() _digest(value, h) return h.digest().encode('hex')
[ "def", "fingerprint", "(", "value", ")", ":", "h", "=", "hashlib", ".", "sha256", "(", ")", "_digest", "(", "value", ",", "h", ")", "return", "h", ".", "digest", "(", ")", ".", "encode", "(", "'hex'", ")" ]
Return a hash value that uniquely identifies the GCL value.
[ "Return", "a", "hash", "value", "that", "uniquely", "identifies", "the", "GCL", "value", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/util.py#L183-L187
rix0rrr/gcl
gcl/util.py
compact_error
def compact_error(err): """Return the the last 2 error messages from an error stack. These error messages turns out to be the most descriptive. """ def err2(e): if isinstance(e, exceptions.EvaluationError) and e.inner: message, i = err2(e.inner) if i == 1: return ', '.join([e.args[0], s...
python
def compact_error(err): """Return the the last 2 error messages from an error stack. These error messages turns out to be the most descriptive. """ def err2(e): if isinstance(e, exceptions.EvaluationError) and e.inner: message, i = err2(e.inner) if i == 1: return ', '.join([e.args[0], s...
[ "def", "compact_error", "(", "err", ")", ":", "def", "err2", "(", "e", ")", ":", "if", "isinstance", "(", "e", ",", "exceptions", ".", "EvaluationError", ")", "and", "e", ".", "inner", ":", "message", ",", "i", "=", "err2", "(", "e", ".", "inner", ...
Return the the last 2 error messages from an error stack. These error messages turns out to be the most descriptive.
[ "Return", "the", "the", "last", "2", "error", "messages", "from", "an", "error", "stack", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/util.py#L280-L294
hannes-brt/hebel
hebel/layers/logistic_layer.py
LogisticLayer.backprop
def backprop(self, input_data, targets, cache=None): """ Backpropagate through the logistic layer. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. ...
python
def backprop(self, input_data, targets, cache=None): """ Backpropagate through the logistic layer. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. ...
[ "def", "backprop", "(", "self", ",", "input_data", ",", "targets", ",", "cache", "=", "None", ")", ":", "if", "cache", "is", "not", "None", ":", "activations", "=", "cache", "else", ":", "activations", "=", "self", ".", "feed_forward", "(", "input_data",...
Backpropagate through the logistic layer. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. cache : list of ``GPUArray`` Cache obtained from forward pass. If the...
[ "Backpropagate", "through", "the", "logistic", "layer", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/logistic_layer.py#L170-L224
hannes-brt/hebel
hebel/layers/logistic_layer.py
LogisticLayer.cross_entropy_error
def cross_entropy_error(self, input_data, targets, average=True, cache=None, prediction=False): """ Return the cross entropy error """ if cache is not None: activations = cache else: activations = \ self.feed_forward(inpu...
python
def cross_entropy_error(self, input_data, targets, average=True, cache=None, prediction=False): """ Return the cross entropy error """ if cache is not None: activations = cache else: activations = \ self.feed_forward(inpu...
[ "def", "cross_entropy_error", "(", "self", ",", "input_data", ",", "targets", ",", "average", "=", "True", ",", "cache", "=", "None", ",", "prediction", "=", "False", ")", ":", "if", "cache", "is", "not", "None", ":", "activations", "=", "cache", "else",...
Return the cross entropy error
[ "Return", "the", "cross", "entropy", "error" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/logistic_layer.py#L271-L286
rix0rrr/gcl
gcl/doc.py
stylize_comment_block
def stylize_comment_block(lines): """Parse comment lines and make subsequent indented lines into a code block block. """ normal, sep, in_code = range(3) state = normal for line in lines: indented = line.startswith(' ') empty_line = line.strip() == '' if state == normal and empty_line: ...
python
def stylize_comment_block(lines): """Parse comment lines and make subsequent indented lines into a code block block. """ normal, sep, in_code = range(3) state = normal for line in lines: indented = line.startswith(' ') empty_line = line.strip() == '' if state == normal and empty_line: ...
[ "def", "stylize_comment_block", "(", "lines", ")", ":", "normal", ",", "sep", ",", "in_code", "=", "range", "(", "3", ")", "state", "=", "normal", "for", "line", "in", "lines", ":", "indented", "=", "line", ".", "startswith", "(", "' '", ")", "empty...
Parse comment lines and make subsequent indented lines into a code block block.
[ "Parse", "comment", "lines", "and", "make", "subsequent", "indented", "lines", "into", "a", "code", "block", "block", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/doc.py#L194-L222
rix0rrr/gcl
gcl/doc.py
sort_members
def sort_members(tup, names): """Return two pairs of members, scalar and tuple members. The scalars will be sorted s.t. the unbound members are at the top. """ scalars, tuples = partition(lambda x: not is_tuple_node(tup.member[x].value), names) unbound, bound = partition(lambda x: tup.member[x].value.is_unbo...
python
def sort_members(tup, names): """Return two pairs of members, scalar and tuple members. The scalars will be sorted s.t. the unbound members are at the top. """ scalars, tuples = partition(lambda x: not is_tuple_node(tup.member[x].value), names) unbound, bound = partition(lambda x: tup.member[x].value.is_unbo...
[ "def", "sort_members", "(", "tup", ",", "names", ")", ":", "scalars", ",", "tuples", "=", "partition", "(", "lambda", "x", ":", "not", "is_tuple_node", "(", "tup", ".", "member", "[", "x", "]", ".", "value", ")", ",", "names", ")", "unbound", ",", ...
Return two pairs of members, scalar and tuple members. The scalars will be sorted s.t. the unbound members are at the top.
[ "Return", "two", "pairs", "of", "members", "scalar", "and", "tuple", "members", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/doc.py#L229-L236
rix0rrr/gcl
gcl/doc.py
resolve_file
def resolve_file(fname, paths): """Resolve filename relatively against one of the given paths, if possible.""" fpath = path.abspath(fname) for p in paths: spath = path.abspath(p) if fpath.startswith(spath): return fpath[len(spath) + 1:] return fname
python
def resolve_file(fname, paths): """Resolve filename relatively against one of the given paths, if possible.""" fpath = path.abspath(fname) for p in paths: spath = path.abspath(p) if fpath.startswith(spath): return fpath[len(spath) + 1:] return fname
[ "def", "resolve_file", "(", "fname", ",", "paths", ")", ":", "fpath", "=", "path", ".", "abspath", "(", "fname", ")", "for", "p", "in", "paths", ":", "spath", "=", "path", ".", "abspath", "(", "p", ")", "if", "fpath", ".", "startswith", "(", "spath...
Resolve filename relatively against one of the given paths, if possible.
[ "Resolve", "filename", "relatively", "against", "one", "of", "the", "given", "paths", "if", "possible", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/doc.py#L262-L269
rix0rrr/gcl
gcl/doc.py
RstTable.generate
def generate(self): """Generate a list of strings representing the table in RST format.""" header = ' '.join('=' * self.width[i] for i in range(self.w)) lines = [ ' '.join(row[i].ljust(self.width[i]) for i in range(self.w)) for row in self.rows] return [header] + lines + [header]
python
def generate(self): """Generate a list of strings representing the table in RST format.""" header = ' '.join('=' * self.width[i] for i in range(self.w)) lines = [ ' '.join(row[i].ljust(self.width[i]) for i in range(self.w)) for row in self.rows] return [header] + lines + [header]
[ "def", "generate", "(", "self", ")", ":", "header", "=", "' '", ".", "join", "(", "'='", "*", "self", ".", "width", "[", "i", "]", "for", "i", "in", "range", "(", "self", ".", "w", ")", ")", "lines", "=", "[", "' '", ".", "join", "(", "row", ...
Generate a list of strings representing the table in RST format.
[ "Generate", "a", "list", "of", "strings", "representing", "the", "table", "in", "RST", "format", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/doc.py#L44-L50
rix0rrr/gcl
gcl/query.py
partition
def partition(pred, iterable): 'Use a predicate to partition entries into false entries and true entries' # partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 t1, t2 = itertools.tee(iterable) return list(filter(negate(pred), t1)), list(filter(pred, t2))
python
def partition(pred, iterable): 'Use a predicate to partition entries into false entries and true entries' # partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9 t1, t2 = itertools.tee(iterable) return list(filter(negate(pred), t1)), list(filter(pred, t2))
[ "def", "partition", "(", "pred", ",", "iterable", ")", ":", "# partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9", "t1", ",", "t2", "=", "itertools", ".", "tee", "(", "iterable", ")", "return", "list", "(", "filter", "(", "negate", "(", "pred", ")", ...
Use a predicate to partition entries into false entries and true entries
[ "Use", "a", "predicate", "to", "partition", "entries", "into", "false", "entries", "and", "true", "entries" ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L63-L67
rix0rrr/gcl
gcl/query.py
GPath.select
def select(self, model): """Select nodes according to the input selector. This can ALWAYS return multiple root elements. """ res = [] def doSelect(value, pre, remaining): if not remaining: res.append((pre, value)) else: # For the other selectors to work, value must be a...
python
def select(self, model): """Select nodes according to the input selector. This can ALWAYS return multiple root elements. """ res = [] def doSelect(value, pre, remaining): if not remaining: res.append((pre, value)) else: # For the other selectors to work, value must be a...
[ "def", "select", "(", "self", ",", "model", ")", ":", "res", "=", "[", "]", "def", "doSelect", "(", "value", ",", "pre", ",", "remaining", ")", ":", "if", "not", "remaining", ":", "res", ".", "append", "(", "(", "pre", ",", "value", ")", ")", "...
Select nodes according to the input selector. This can ALWAYS return multiple root elements.
[ "Select", "nodes", "according", "to", "the", "input", "selector", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L85-L124
rix0rrr/gcl
gcl/query.py
QueryResult.deep
def deep(self): """Return a deep dict of the values selected. The leaf values may still be gcl Tuples. Use util.to_python() if you want to reify everything to real Python values. """ self.lists = {} ret = {} for path, value in self.paths_values(): self.recursiveSet(ret, path, value) ...
python
def deep(self): """Return a deep dict of the values selected. The leaf values may still be gcl Tuples. Use util.to_python() if you want to reify everything to real Python values. """ self.lists = {} ret = {} for path, value in self.paths_values(): self.recursiveSet(ret, path, value) ...
[ "def", "deep", "(", "self", ")", ":", "self", ".", "lists", "=", "{", "}", "ret", "=", "{", "}", "for", "path", ",", "value", "in", "self", ".", "paths_values", "(", ")", ":", "self", ".", "recursiveSet", "(", "ret", ",", "path", ",", "value", ...
Return a deep dict of the values selected. The leaf values may still be gcl Tuples. Use util.to_python() if you want to reify everything to real Python values.
[ "Return", "a", "deep", "dict", "of", "the", "values", "selected", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L145-L156
rix0rrr/gcl
gcl/query.py
QueryResult.ldSet
def ldSet(self, what, key, value): """List/dictionary-aware set.""" if isListKey(key): # Make sure we keep the indexes consistent, insert missing_values # as necessary. We do remember the lists, so that we can remove # missing values after inserting all values from all selectors. self.li...
python
def ldSet(self, what, key, value): """List/dictionary-aware set.""" if isListKey(key): # Make sure we keep the indexes consistent, insert missing_values # as necessary. We do remember the lists, so that we can remove # missing values after inserting all values from all selectors. self.li...
[ "def", "ldSet", "(", "self", ",", "what", ",", "key", ",", "value", ")", ":", "if", "isListKey", "(", "key", ")", ":", "# Make sure we keep the indexes consistent, insert missing_values", "# as necessary. We do remember the lists, so that we can remove", "# missing values aft...
List/dictionary-aware set.
[ "List", "/", "dictionary", "-", "aware", "set", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L173-L186
rix0rrr/gcl
gcl/query.py
QueryResult.ldGet
def ldGet(self, what, key): """List-aware get.""" if isListKey(key): return what[listKeyIndex(key)] else: return what[key]
python
def ldGet(self, what, key): """List-aware get.""" if isListKey(key): return what[listKeyIndex(key)] else: return what[key]
[ "def", "ldGet", "(", "self", ",", "what", ",", "key", ")", ":", "if", "isListKey", "(", "key", ")", ":", "return", "what", "[", "listKeyIndex", "(", "key", ")", "]", "else", ":", "return", "what", "[", "key", "]" ]
List-aware get.
[ "List", "-", "aware", "get", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L188-L193
rix0rrr/gcl
gcl/query.py
QueryResult.ldContains
def ldContains(self, what, key): """List/dictinary/missing-aware contains. If the value is a "missing_value", we'll treat it as non-existent so it will be overwritten by an empty list/dict when necessary to assign child keys. """ if isListKey(key): i = listKeyIndex(key) return i < l...
python
def ldContains(self, what, key): """List/dictinary/missing-aware contains. If the value is a "missing_value", we'll treat it as non-existent so it will be overwritten by an empty list/dict when necessary to assign child keys. """ if isListKey(key): i = listKeyIndex(key) return i < l...
[ "def", "ldContains", "(", "self", ",", "what", ",", "key", ")", ":", "if", "isListKey", "(", "key", ")", ":", "i", "=", "listKeyIndex", "(", "key", ")", "return", "i", "<", "len", "(", "what", ")", "and", "what", "[", "i", "]", "!=", "missing_val...
List/dictinary/missing-aware contains. If the value is a "missing_value", we'll treat it as non-existent so it will be overwritten by an empty list/dict when necessary to assign child keys.
[ "List", "/", "dictinary", "/", "missing", "-", "aware", "contains", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L195-L206
rix0rrr/gcl
gcl/query.py
TupleFinder.find_recursive_dependency
def find_recursive_dependency(self): """Return a list of nodes that have a recursive dependency.""" nodes_on_path = [] def helper(nodes): for node in nodes: cycle = node in nodes_on_path nodes_on_path.append(node) if cycle or helper(self.deps.get(node, [])): return T...
python
def find_recursive_dependency(self): """Return a list of nodes that have a recursive dependency.""" nodes_on_path = [] def helper(nodes): for node in nodes: cycle = node in nodes_on_path nodes_on_path.append(node) if cycle or helper(self.deps.get(node, [])): return T...
[ "def", "find_recursive_dependency", "(", "self", ")", ":", "nodes_on_path", "=", "[", "]", "def", "helper", "(", "nodes", ")", ":", "for", "node", "in", "nodes", ":", "cycle", "=", "node", "in", "nodes_on_path", "nodes_on_path", ".", "append", "(", "node",...
Return a list of nodes that have a recursive dependency.
[ "Return", "a", "list", "of", "nodes", "that", "have", "a", "recursive", "dependency", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L307-L321
rix0rrr/gcl
gcl/query.py
TupleFinder.enterTuple
def enterTuple(self, tuple, path): """Called for every tuple. If this returns False, the elements of the tuple will not be recursed over and leaveTuple() will not be called. """ if skip_name(path): return False node = Node(path, tuple) if self.condition.matches(node): self.unord...
python
def enterTuple(self, tuple, path): """Called for every tuple. If this returns False, the elements of the tuple will not be recursed over and leaveTuple() will not be called. """ if skip_name(path): return False node = Node(path, tuple) if self.condition.matches(node): self.unord...
[ "def", "enterTuple", "(", "self", ",", "tuple", ",", "path", ")", ":", "if", "skip_name", "(", "path", ")", ":", "return", "False", "node", "=", "Node", "(", "path", ",", "tuple", ")", "if", "self", ".", "condition", ".", "matches", "(", "node", ")...
Called for every tuple. If this returns False, the elements of the tuple will not be recursed over and leaveTuple() will not be called.
[ "Called", "for", "every", "tuple", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/query.py#L324-L336
rix0rrr/gcl
gcl/ast.py
convertAndMake
def convertAndMake(converter, handler): """Convert with location.""" def convertAction(loc, value): return handler(loc, converter(value)) return convertAction
python
def convertAndMake(converter, handler): """Convert with location.""" def convertAction(loc, value): return handler(loc, converter(value)) return convertAction
[ "def", "convertAndMake", "(", "converter", ",", "handler", ")", ":", "def", "convertAction", "(", "loc", ",", "value", ")", ":", "return", "handler", "(", "loc", ",", "converter", "(", "value", ")", ")", "return", "convertAction" ]
Convert with location.
[ "Convert", "with", "location", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L75-L79
rix0rrr/gcl
gcl/ast.py
mkApplications
def mkApplications(location, *atoms): """Make a sequence of applications from a list of tokens. atoms is a list of atoms, which will be handled left-associatively. E.g: ['foo', [], []] == foo()() ==> Application(Application('foo', []), []) """ atoms = list(atoms) while len(atoms) > 1: atoms[0:2] =...
python
def mkApplications(location, *atoms): """Make a sequence of applications from a list of tokens. atoms is a list of atoms, which will be handled left-associatively. E.g: ['foo', [], []] == foo()() ==> Application(Application('foo', []), []) """ atoms = list(atoms) while len(atoms) > 1: atoms[0:2] =...
[ "def", "mkApplications", "(", "location", ",", "*", "atoms", ")", ":", "atoms", "=", "list", "(", "atoms", ")", "while", "len", "(", "atoms", ")", ">", "1", ":", "atoms", "[", "0", ":", "2", "]", "=", "[", "Application", "(", "location", ",", "at...
Make a sequence of applications from a list of tokens. atoms is a list of atoms, which will be handled left-associatively. E.g: ['foo', [], []] == foo()() ==> Application(Application('foo', []), [])
[ "Make", "a", "sequence", "of", "applications", "from", "a", "list", "of", "tokens", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L528-L540
rix0rrr/gcl
gcl/ast.py
call_fn
def call_fn(fn, arglist, env): """Call a function, respecting all the various types of functions that exist.""" if isinstance(fn, framework.LazyFunction): # The following looks complicated, but this is necessary because you can't # construct closures over the loop variable directly. thunks = [(lambda th...
python
def call_fn(fn, arglist, env): """Call a function, respecting all the various types of functions that exist.""" if isinstance(fn, framework.LazyFunction): # The following looks complicated, but this is necessary because you can't # construct closures over the loop variable directly. thunks = [(lambda th...
[ "def", "call_fn", "(", "fn", ",", "arglist", ",", "env", ")", ":", "if", "isinstance", "(", "fn", ",", "framework", ".", "LazyFunction", ")", ":", "# The following looks complicated, but this is necessary because you can't", "# construct closures over the loop variable dire...
Call a function, respecting all the various types of functions that exist.
[ "Call", "a", "function", "respecting", "all", "the", "various", "types", "of", "functions", "that", "exist", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L595-L607
rix0rrr/gcl
gcl/ast.py
schema_spec_from_tuple
def schema_spec_from_tuple(tup): """Return the schema spec from a run-time tuple.""" if hasattr(tup, 'get_schema_spec'): # Tuples have a TupleSchema field that contains a model of the schema return schema.from_spec({ 'fields': TupleSchemaAccess(tup), 'required': tup.get_required_fields()}) ...
python
def schema_spec_from_tuple(tup): """Return the schema spec from a run-time tuple.""" if hasattr(tup, 'get_schema_spec'): # Tuples have a TupleSchema field that contains a model of the schema return schema.from_spec({ 'fields': TupleSchemaAccess(tup), 'required': tup.get_required_fields()}) ...
[ "def", "schema_spec_from_tuple", "(", "tup", ")", ":", "if", "hasattr", "(", "tup", ",", "'get_schema_spec'", ")", ":", "# Tuples have a TupleSchema field that contains a model of the schema", "return", "schema", ".", "from_spec", "(", "{", "'fields'", ":", "TupleSchema...
Return the schema spec from a run-time tuple.
[ "Return", "the", "schema", "spec", "from", "a", "run", "-", "time", "tuple", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L847-L854
rix0rrr/gcl
gcl/ast.py
make_schema_from
def make_schema_from(value, env): """Make a Schema object from the given spec. The input and output types of this function are super unclear, and are held together by ponies, wishes, duct tape, and a load of tests. See the comments for horrific entertainment. """ # So this thing may not need to evaluate any...
python
def make_schema_from(value, env): """Make a Schema object from the given spec. The input and output types of this function are super unclear, and are held together by ponies, wishes, duct tape, and a load of tests. See the comments for horrific entertainment. """ # So this thing may not need to evaluate any...
[ "def", "make_schema_from", "(", "value", ",", "env", ")", ":", "# So this thing may not need to evaluate anything[0]", "if", "isinstance", "(", "value", ",", "framework", ".", "Thunk", ")", ":", "value", "=", "framework", ".", "eval", "(", "value", ",", "env", ...
Make a Schema object from the given spec. The input and output types of this function are super unclear, and are held together by ponies, wishes, duct tape, and a load of tests. See the comments for horrific entertainment.
[ "Make", "a", "Schema", "object", "from", "the", "given", "spec", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L857-L884
rix0rrr/gcl
gcl/ast.py
bracketedList
def bracketedList(l, r, sep, expr, allow_missing_close=False): """Parse bracketed list. Empty list is possible, as is a trailing separator. """ # We may need to backtrack for lists, because of list comprehension, but not for # any of the other lists strict = l != '[' closer = sym(r) if not allow_missing_...
python
def bracketedList(l, r, sep, expr, allow_missing_close=False): """Parse bracketed list. Empty list is possible, as is a trailing separator. """ # We may need to backtrack for lists, because of list comprehension, but not for # any of the other lists strict = l != '[' closer = sym(r) if not allow_missing_...
[ "def", "bracketedList", "(", "l", ",", "r", ",", "sep", ",", "expr", ",", "allow_missing_close", "=", "False", ")", ":", "# We may need to backtrack for lists, because of list comprehension, but not for", "# any of the other lists", "strict", "=", "l", "!=", "'['", "clo...
Parse bracketed list. Empty list is possible, as is a trailing separator.
[ "Parse", "bracketed", "list", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L909-L921
rix0rrr/gcl
gcl/ast.py
unquote
def unquote(s): """Unquote the indicated string.""" # Ignore the left- and rightmost chars (which should be quotes). # Use the Python engine to decode the escape sequence i, N = 1, len(s) - 1 ret = [] while i < N: if s[i] == '\\' and i < N - 1: ret.append(UNQUOTE_MAP.get(s[i+1], s[i+1])) i +...
python
def unquote(s): """Unquote the indicated string.""" # Ignore the left- and rightmost chars (which should be quotes). # Use the Python engine to decode the escape sequence i, N = 1, len(s) - 1 ret = [] while i < N: if s[i] == '\\' and i < N - 1: ret.append(UNQUOTE_MAP.get(s[i+1], s[i+1])) i +...
[ "def", "unquote", "(", "s", ")", ":", "# Ignore the left- and rightmost chars (which should be quotes).", "# Use the Python engine to decode the escape sequence", "i", ",", "N", "=", "1", ",", "len", "(", "s", ")", "-", "1", "ret", "=", "[", "]", "while", "i", "<"...
Unquote the indicated string.
[ "Unquote", "the", "indicated", "string", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L924-L937
rix0rrr/gcl
gcl/ast.py
pattern
def pattern(name, pattern): """Function to put a name on a pyparsing pattern. Just for ease of debugging/tracing parse errors. """ pattern.setName(name) astracing.maybe_trace(pattern) return pattern
python
def pattern(name, pattern): """Function to put a name on a pyparsing pattern. Just for ease of debugging/tracing parse errors. """ pattern.setName(name) astracing.maybe_trace(pattern) return pattern
[ "def", "pattern", "(", "name", ",", "pattern", ")", ":", "pattern", ".", "setName", "(", "name", ")", "astracing", ".", "maybe_trace", "(", "pattern", ")", "return", "pattern" ]
Function to put a name on a pyparsing pattern. Just for ease of debugging/tracing parse errors.
[ "Function", "to", "put", "a", "name", "on", "a", "pyparsing", "pattern", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L947-L954
rix0rrr/gcl
gcl/ast.py
make_grammar
def make_grammar(allow_errors): """Make the part of the grammar that depends on whether we swallow errors or not.""" if allow_errors in GRAMMAR_CACHE: return GRAMMAR_CACHE[allow_errors] tuple = p.Forward() catch_errors = p.Forward() catch_errors << (p.Regex('[^{};]*') - p.Optional(tuple) - p.Regex('[^;}]...
python
def make_grammar(allow_errors): """Make the part of the grammar that depends on whether we swallow errors or not.""" if allow_errors in GRAMMAR_CACHE: return GRAMMAR_CACHE[allow_errors] tuple = p.Forward() catch_errors = p.Forward() catch_errors << (p.Regex('[^{};]*') - p.Optional(tuple) - p.Regex('[^;}]...
[ "def", "make_grammar", "(", "allow_errors", ")", ":", "if", "allow_errors", "in", "GRAMMAR_CACHE", ":", "return", "GRAMMAR_CACHE", "[", "allow_errors", "]", "tuple", "=", "p", ".", "Forward", "(", ")", "catch_errors", "=", "p", ".", "Forward", "(", ")", "c...
Make the part of the grammar that depends on whether we swallow errors or not.
[ "Make", "the", "part", "of", "the", "grammar", "that", "depends", "on", "whether", "we", "swallow", "errors", "or", "not", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L958-L1107
rix0rrr/gcl
gcl/ast.py
reads
def reads(s, filename, loader, implicit_tuple, allow_errors): """Load but don't evaluate a GCL expression from a string.""" try: the_context.filename = filename the_context.loader = loader grammar = make_grammar(allow_errors=allow_errors) root = grammar.start_tuple if implicit_tuple else grammar.st...
python
def reads(s, filename, loader, implicit_tuple, allow_errors): """Load but don't evaluate a GCL expression from a string.""" try: the_context.filename = filename the_context.loader = loader grammar = make_grammar(allow_errors=allow_errors) root = grammar.start_tuple if implicit_tuple else grammar.st...
[ "def", "reads", "(", "s", ",", "filename", ",", "loader", ",", "implicit_tuple", ",", "allow_errors", ")", ":", "try", ":", "the_context", ".", "filename", "=", "filename", "the_context", ".", "loader", "=", "loader", "grammar", "=", "make_grammar", "(", "...
Load but don't evaluate a GCL expression from a string.
[ "Load", "but", "don", "t", "evaluate", "a", "GCL", "expression", "from", "a", "string", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L1131-L1143
rix0rrr/gcl
gcl/ast.py
AstNode.find_tokens
def find_tokens(self, q): """Find all AST nodes at the given filename, line and column.""" found_me = [] if hasattr(self, 'location'): if self.location.contains(q): found_me = [self] elif self._found_by(q): found_me = [self] cs = [n.find_tokens(q) for n in self._children()] ...
python
def find_tokens(self, q): """Find all AST nodes at the given filename, line and column.""" found_me = [] if hasattr(self, 'location'): if self.location.contains(q): found_me = [self] elif self._found_by(q): found_me = [self] cs = [n.find_tokens(q) for n in self._children()] ...
[ "def", "find_tokens", "(", "self", ",", "q", ")", ":", "found_me", "=", "[", "]", "if", "hasattr", "(", "self", ",", "'location'", ")", ":", "if", "self", ".", "location", ".", "contains", "(", "q", ")", ":", "found_me", "=", "[", "self", "]", "e...
Find all AST nodes at the given filename, line and column.
[ "Find", "all", "AST", "nodes", "at", "the", "given", "filename", "line", "and", "column", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L156-L166
rix0rrr/gcl
gcl/ast.py
TupleNode._make_tuple
def _make_tuple(self, env): """Instantiate the Tuple based on this TupleNode.""" t = runtime.Tuple(self, env, dict2tuple) # A tuple also provides its own schema spec schema = schema_spec_from_tuple(t) t.attach_schema(schema) return t
python
def _make_tuple(self, env): """Instantiate the Tuple based on this TupleNode.""" t = runtime.Tuple(self, env, dict2tuple) # A tuple also provides its own schema spec schema = schema_spec_from_tuple(t) t.attach_schema(schema) return t
[ "def", "_make_tuple", "(", "self", ",", "env", ")", ":", "t", "=", "runtime", ".", "Tuple", "(", "self", ",", "env", ",", "dict2tuple", ")", "# A tuple also provides its own schema spec", "schema", "=", "schema_spec_from_tuple", "(", "t", ")", "t", ".", "att...
Instantiate the Tuple based on this TupleNode.
[ "Instantiate", "the", "Tuple", "based", "on", "this", "TupleNode", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L433-L439
rix0rrr/gcl
gcl/ast.py
Application.applyTuple
def applyTuple(self, tuple, right, env): """Apply a tuple to something else.""" if len(right) != 1: raise exceptions.EvaluationError('Tuple (%r) can only be applied to one argument, got %r' % (self.left, self.right)) right = right[0] return tuple(right)
python
def applyTuple(self, tuple, right, env): """Apply a tuple to something else.""" if len(right) != 1: raise exceptions.EvaluationError('Tuple (%r) can only be applied to one argument, got %r' % (self.left, self.right)) right = right[0] return tuple(right)
[ "def", "applyTuple", "(", "self", ",", "tuple", ",", "right", ",", "env", ")", ":", "if", "len", "(", "right", ")", "!=", "1", ":", "raise", "exceptions", ".", "EvaluationError", "(", "'Tuple (%r) can only be applied to one argument, got %r'", "%", "(", "self"...
Apply a tuple to something else.
[ "Apply", "a", "tuple", "to", "something", "else", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L508-L514
rix0rrr/gcl
gcl/ast.py
Application.applyIndex
def applyIndex(self, lst, right): """Apply a list to something else.""" if len(right) != 1: raise exceptions.EvaluationError('%r can only be applied to one argument, got %r' % (self.left, self.right)) right = right[0] if isinstance(right, int): return lst[right] raise exceptions.Evalua...
python
def applyIndex(self, lst, right): """Apply a list to something else.""" if len(right) != 1: raise exceptions.EvaluationError('%r can only be applied to one argument, got %r' % (self.left, self.right)) right = right[0] if isinstance(right, int): return lst[right] raise exceptions.Evalua...
[ "def", "applyIndex", "(", "self", ",", "lst", ",", "right", ")", ":", "if", "len", "(", "right", ")", "!=", "1", ":", "raise", "exceptions", ".", "EvaluationError", "(", "'%r can only be applied to one argument, got %r'", "%", "(", "self", ".", "left", ",", ...
Apply a list to something else.
[ "Apply", "a", "list", "to", "something", "else", "." ]
train
https://github.com/rix0rrr/gcl/blob/4e3bccc978a9c60aaaffd20f6f291c4d23775cdf/gcl/ast.py#L516-L525
hannes-brt/hebel
hebel/parameter_updaters.py
NesterovMomentumUpdate.pre_gradient_update
def pre_gradient_update(self): """ First step of Nesterov momentum method: take step in direction of accumulated gradient """ updates = zip(self.velocity, self.model.n_parameters * [1.]) self.model.update_parameters(updates)
python
def pre_gradient_update(self): """ First step of Nesterov momentum method: take step in direction of accumulated gradient """ updates = zip(self.velocity, self.model.n_parameters * [1.]) self.model.update_parameters(updates)
[ "def", "pre_gradient_update", "(", "self", ")", ":", "updates", "=", "zip", "(", "self", ".", "velocity", ",", "self", ".", "model", ".", "n_parameters", "*", "[", "1.", "]", ")", "self", ".", "model", ".", "update_parameters", "(", "updates", ")" ]
First step of Nesterov momentum method: take step in direction of accumulated gradient
[ "First", "step", "of", "Nesterov", "momentum", "method", ":", "take", "step", "in", "direction", "of", "accumulated", "gradient" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/parameter_updaters.py#L70-L76
hannes-brt/hebel
hebel/layers/softmax_layer.py
SoftmaxLayer.class_error
def class_error(self, input_data, targets, average=True, cache=None, prediction=False): """ Return the classification error rate """ if cache is not None: activations = cache else: activations = \ self.feed_forward(input_data, pr...
python
def class_error(self, input_data, targets, average=True, cache=None, prediction=False): """ Return the classification error rate """ if cache is not None: activations = cache else: activations = \ self.feed_forward(input_data, pr...
[ "def", "class_error", "(", "self", ",", "input_data", ",", "targets", ",", "average", "=", "True", ",", "cache", "=", "None", ",", "prediction", "=", "False", ")", ":", "if", "cache", "is", "not", "None", ":", "activations", "=", "cache", "else", ":", ...
Return the classification error rate
[ "Return", "the", "classification", "error", "rate" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/softmax_layer.py#L293-L308
hannes-brt/hebel
hebel/layers/softmax_layer.py
SoftmaxLayer.kl_error
def kl_error(self, input_data, targets, average=True, cache=None, prediction=True): """ The KL divergence error """ if cache is not None: activations = cache else: activations = \ self.feed_forward(input_data, prediction=prediction)...
python
def kl_error(self, input_data, targets, average=True, cache=None, prediction=True): """ The KL divergence error """ if cache is not None: activations = cache else: activations = \ self.feed_forward(input_data, prediction=prediction)...
[ "def", "kl_error", "(", "self", ",", "input_data", ",", "targets", ",", "average", "=", "True", ",", "cache", "=", "None", ",", "prediction", "=", "True", ")", ":", "if", "cache", "is", "not", "None", ":", "activations", "=", "cache", "else", ":", "a...
The KL divergence error
[ "The", "KL", "divergence", "error" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/softmax_layer.py#L310-L328
hannes-brt/hebel
hebel/pycuda_ops/linalg.py
dot
def dot(x_gpu, y_gpu, transa='N', transb='N', handle=None, target=None): """ Dot product of two arrays. For 1D arrays, this function computes the inner product. For 2D arrays of shapes `(m, k)` and `(k, n)`, it computes the matrix product; the result has shape `(m, n)`. Parameters --------...
python
def dot(x_gpu, y_gpu, transa='N', transb='N', handle=None, target=None): """ Dot product of two arrays. For 1D arrays, this function computes the inner product. For 2D arrays of shapes `(m, k)` and `(k, n)`, it computes the matrix product; the result has shape `(m, n)`. Parameters --------...
[ "def", "dot", "(", "x_gpu", ",", "y_gpu", ",", "transa", "=", "'N'", ",", "transb", "=", "'N'", ",", "handle", "=", "None", ",", "target", "=", "None", ")", ":", "if", "handle", "is", "None", ":", "handle", "=", "_global_cublas_handle", "if", "len", ...
Dot product of two arrays. For 1D arrays, this function computes the inner product. For 2D arrays of shapes `(m, k)` and `(k, n)`, it computes the matrix product; the result has shape `(m, n)`. Parameters ---------- x_gpu : pycuda.gpuarray.GPUArray Input array. y_gpu : pycuda.gpuar...
[ "Dot", "product", "of", "two", "arrays", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/linalg.py#L39-L199
smartfile/django-transfer
django_transfer/views.py
make_tempfile
def make_tempfile(data=None): "Create a temp file, write our PID into it." with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp: temp.write(six.text_type(data if data is not None else os.getpid())) return temp.name
python
def make_tempfile(data=None): "Create a temp file, write our PID into it." with tempfile.NamedTemporaryFile(mode='w', delete=False) as temp: temp.write(six.text_type(data if data is not None else os.getpid())) return temp.name
[ "def", "make_tempfile", "(", "data", "=", "None", ")", ":", "with", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'w'", ",", "delete", "=", "False", ")", "as", "temp", ":", "temp", ".", "write", "(", "six", ".", "text_type", "(", "data", ...
Create a temp file, write our PID into it.
[ "Create", "a", "temp", "file", "write", "our", "PID", "into", "it", "." ]
train
https://github.com/smartfile/django-transfer/blob/65ef60e011c1b98d7f5a195debd81b3efde897dd/django_transfer/views.py#L13-L17
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
MultitaskTopLayer.parameters
def parameters(self): """Return a list where each element contains the parameters for a task. """ parameters = [] for task in self.tasks: parameters.extend(task.parameters) return parameters
python
def parameters(self): """Return a list where each element contains the parameters for a task. """ parameters = [] for task in self.tasks: parameters.extend(task.parameters) return parameters
[ "def", "parameters", "(", "self", ")", ":", "parameters", "=", "[", "]", "for", "task", "in", "self", ".", "tasks", ":", "parameters", ".", "extend", "(", "task", ".", "parameters", ")", "return", "parameters" ]
Return a list where each element contains the parameters for a task.
[ "Return", "a", "list", "where", "each", "element", "contains", "the", "parameters", "for", "a", "task", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L178-L184
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
MultitaskTopLayer.parameters
def parameters(self, value): """Update the parameters. ``value`` must be a list/tuple of length ``MultitaskTopLayer.n_tasks``, each element of which must have the correct number of parameters for the task. """ assert len(value) == self.n_parameters i = 0 ...
python
def parameters(self, value): """Update the parameters. ``value`` must be a list/tuple of length ``MultitaskTopLayer.n_tasks``, each element of which must have the correct number of parameters for the task. """ assert len(value) == self.n_parameters i = 0 ...
[ "def", "parameters", "(", "self", ",", "value", ")", ":", "assert", "len", "(", "value", ")", "==", "self", ".", "n_parameters", "i", "=", "0", "for", "task", "in", "self", ".", "tasks", ":", "task", ".", "parameters", "=", "value", "[", "i", ":", ...
Update the parameters. ``value`` must be a list/tuple of length ``MultitaskTopLayer.n_tasks``, each element of which must have the correct number of parameters for the task.
[ "Update", "the", "parameters", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L187-L199
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
MultitaskTopLayer.feed_forward
def feed_forward(self, input_data, prediction=False): """Call ``feed_forward`` for each task and combine the activations. Passes ``input_data`` to all tasks and returns the activations as a list. **Parameters:** input_data : ``GPUArray`` Inpute data to compute ...
python
def feed_forward(self, input_data, prediction=False): """Call ``feed_forward`` for each task and combine the activations. Passes ``input_data`` to all tasks and returns the activations as a list. **Parameters:** input_data : ``GPUArray`` Inpute data to compute ...
[ "def", "feed_forward", "(", "self", ",", "input_data", ",", "prediction", "=", "False", ")", ":", "activations", "=", "[", "]", "for", "task", "in", "self", ".", "tasks", ":", "activations_task", "=", "task", ".", "feed_forward", "(", "input_data", ",", ...
Call ``feed_forward`` for each task and combine the activations. Passes ``input_data`` to all tasks and returns the activations as a list. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. prediction : bool, optional ...
[ "Call", "feed_forward", "for", "each", "task", "and", "combine", "the", "activations", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L223-L251
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
MultitaskTopLayer.backprop
def backprop(self, input_data, targets, cache=None): """Compute gradients for each task and combine the results. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. ca...
python
def backprop(self, input_data, targets, cache=None): """Compute gradients for each task and combine the results. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. ca...
[ "def", "backprop", "(", "self", ",", "input_data", ",", "targets", ",", "cache", "=", "None", ")", ":", "df_input", "=", "gpuarray", ".", "zeros_like", "(", "input_data", ")", "if", "cache", "is", "None", ":", "cache", "=", "self", ".", "n_tasks", "*",...
Compute gradients for each task and combine the results. **Parameters:** input_data : ``GPUArray`` Inpute data to compute activations for. targets : ``GPUArray`` The target values of the units. cache : list of ``GPUArray`` Cache obtained from forwa...
[ "Compute", "gradients", "for", "each", "task", "and", "combine", "the", "results", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L253-L294
hannes-brt/hebel
hebel/layers/multitask_top_layer.py
MultitaskTopLayer.cross_entropy_error
def cross_entropy_error(self, input_data, targets, average=True, cache=None, prediction=False, sum_errors=True): """ Computes the cross-entropy error for all tasks. """ loss = [] if cache is None: cache = self.n_tasks *...
python
def cross_entropy_error(self, input_data, targets, average=True, cache=None, prediction=False, sum_errors=True): """ Computes the cross-entropy error for all tasks. """ loss = [] if cache is None: cache = self.n_tasks *...
[ "def", "cross_entropy_error", "(", "self", ",", "input_data", ",", "targets", ",", "average", "=", "True", ",", "cache", "=", "None", ",", "prediction", "=", "False", ",", "sum_errors", "=", "True", ")", ":", "loss", "=", "[", "]", "if", "cache", "is",...
Computes the cross-entropy error for all tasks.
[ "Computes", "the", "cross", "-", "entropy", "error", "for", "all", "tasks", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/multitask_top_layer.py#L348-L368
hannes-brt/hebel
hebel/layers/hidden_layer.py
HiddenLayer.parameters
def parameters(self, value): """Update the parameters. ``value`` must have the shape ``(weights, biases)``""" self.W = value[0] if isinstance(value[0], GPUArray) else \ gpuarray.to_gpu(value[0]) self.b = value[1] if isinstance(value[0], GPUArray) else \ gpuarray.to_gp...
python
def parameters(self, value): """Update the parameters. ``value`` must have the shape ``(weights, biases)``""" self.W = value[0] if isinstance(value[0], GPUArray) else \ gpuarray.to_gpu(value[0]) self.b = value[1] if isinstance(value[0], GPUArray) else \ gpuarray.to_gp...
[ "def", "parameters", "(", "self", ",", "value", ")", ":", "self", ".", "W", "=", "value", "[", "0", "]", "if", "isinstance", "(", "value", "[", "0", "]", ",", "GPUArray", ")", "else", "gpuarray", ".", "to_gpu", "(", "value", "[", "0", "]", ")", ...
Update the parameters. ``value`` must have the shape ``(weights, biases)``
[ "Update", "the", "parameters", ".", "value", "must", "have", "the", "shape", "(", "weights", "biases", ")" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/hidden_layer.py#L161-L167
hannes-brt/hebel
hebel/layers/hidden_layer.py
HiddenLayer.architecture
def architecture(self): """Returns a dictionary describing the architecture of the layer.""" arch = {'class': self.__class__, 'n_in': self.n_in, 'n_units': self.n_units, 'activation_function': self.activation_function if hasattr(self, 'acti...
python
def architecture(self): """Returns a dictionary describing the architecture of the layer.""" arch = {'class': self.__class__, 'n_in': self.n_in, 'n_units': self.n_units, 'activation_function': self.activation_function if hasattr(self, 'acti...
[ "def", "architecture", "(", "self", ")", ":", "arch", "=", "{", "'class'", ":", "self", ".", "__class__", ",", "'n_in'", ":", "self", ".", "n_in", ",", "'n_units'", ":", "self", ".", "n_units", ",", "'activation_function'", ":", "self", ".", "activation_...
Returns a dictionary describing the architecture of the layer.
[ "Returns", "a", "dictionary", "describing", "the", "architecture", "of", "the", "layer", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/hidden_layer.py#L178-L185
hannes-brt/hebel
hebel/layers/hidden_layer.py
HiddenLayer.feed_forward
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. prediction : bool, optional Whether to use prediction model. Only relevant when using ...
python
def feed_forward(self, input_data, prediction=False): """Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. prediction : bool, optional Whether to use prediction model. Only relevant when using ...
[ "def", "feed_forward", "(", "self", ",", "input_data", ",", "prediction", "=", "False", ")", ":", "if", "input_data", ".", "shape", "[", "1", "]", "!=", "self", ".", "W", ".", "shape", "[", "0", "]", ":", "raise", "ValueError", "(", "'Number of outputs...
Propagate forward through the layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. prediction : bool, optional Whether to use prediction model. Only relevant when using dropout. If true, then weights are multiplied by ...
[ "Propagate", "forward", "through", "the", "layer" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/hidden_layer.py#L226-L262
hannes-brt/hebel
hebel/layers/hidden_layer.py
HiddenLayer.backprop
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. df_output : ``GPUArray`` Gradients with respect to the activations of this layer ...
python
def backprop(self, input_data, df_output, cache=None): """ Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. df_output : ``GPUArray`` Gradients with respect to the activations of this layer ...
[ "def", "backprop", "(", "self", ",", "input_data", ",", "df_output", ",", "cache", "=", "None", ")", ":", "# Get cache if it wasn't provided", "if", "cache", "is", "None", ":", "cache", "=", "self", ".", "feed_forward", "(", "input_data", ",", "prediction", ...
Backpropagate through the hidden layer **Parameters:** input_data : ``GPUArray`` Input data to compute activations for. df_output : ``GPUArray`` Gradients with respect to the activations of this layer (received from the layer above). cache : list o...
[ "Backpropagate", "through", "the", "hidden", "layer" ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/layers/hidden_layer.py#L264-L323
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasCreate
def cublasCreate(): """ Initialize CUBLAS. Initializes CUBLAS and creates a handle to a structure holding the CUBLAS library context. Returns ------- handle : void_p CUBLAS context. """ handle = ctypes.c_void_p() status = _libcublas.cublasCreate_v2(ctypes....
python
def cublasCreate(): """ Initialize CUBLAS. Initializes CUBLAS and creates a handle to a structure holding the CUBLAS library context. Returns ------- handle : void_p CUBLAS context. """ handle = ctypes.c_void_p() status = _libcublas.cublasCreate_v2(ctypes....
[ "def", "cublasCreate", "(", ")", ":", "handle", "=", "ctypes", ".", "c_void_p", "(", ")", "status", "=", "_libcublas", ".", "cublasCreate_v2", "(", "ctypes", ".", "byref", "(", "handle", ")", ")", "cublasCheckStatus", "(", "status", ")", "return", "handle"...
Initialize CUBLAS. Initializes CUBLAS and creates a handle to a structure holding the CUBLAS library context. Returns ------- handle : void_p CUBLAS context.
[ "Initialize", "CUBLAS", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L185-L202
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasDestroy
def cublasDestroy(handle): """ Release CUBLAS resources. Releases hardware resources used by CUBLAS. Parameters ---------- handle : void_p CUBLAS context. """ status = _libcublas.cublasDestroy_v2(ctypes.c_void_p(handle)) cublasCheckStatus(status)
python
def cublasDestroy(handle): """ Release CUBLAS resources. Releases hardware resources used by CUBLAS. Parameters ---------- handle : void_p CUBLAS context. """ status = _libcublas.cublasDestroy_v2(ctypes.c_void_p(handle)) cublasCheckStatus(status)
[ "def", "cublasDestroy", "(", "handle", ")", ":", "status", "=", "_libcublas", ".", "cublasDestroy_v2", "(", "ctypes", ".", "c_void_p", "(", "handle", ")", ")", "cublasCheckStatus", "(", "status", ")" ]
Release CUBLAS resources. Releases hardware resources used by CUBLAS. Parameters ---------- handle : void_p CUBLAS context.
[ "Release", "CUBLAS", "resources", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L206-L220
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasGetVersion
def cublasGetVersion(handle): """ Get CUBLAS version. Returns version number of installed CUBLAS libraries. Parameters ---------- handle : void_p CUBLAS context. Returns ------- version : int CUBLAS version. """ version = ctypes.c_int() status = _...
python
def cublasGetVersion(handle): """ Get CUBLAS version. Returns version number of installed CUBLAS libraries. Parameters ---------- handle : void_p CUBLAS context. Returns ------- version : int CUBLAS version. """ version = ctypes.c_int() status = _...
[ "def", "cublasGetVersion", "(", "handle", ")", ":", "version", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcublas", ".", "cublasGetVersion_v2", "(", "handle", ",", "ctypes", ".", "byref", "(", "version", ")", ")", "cublasCheckStatus", "(", "...
Get CUBLAS version. Returns version number of installed CUBLAS libraries. Parameters ---------- handle : void_p CUBLAS context. Returns ------- version : int CUBLAS version.
[ "Get", "CUBLAS", "version", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L225-L246
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasSetStream
def cublasSetStream(handle, id): """ Set current CUBLAS library stream. Parameters ---------- handle : id CUBLAS context. id : int Stream ID. """ status = _libcublas.cublasSetStream_v2(handle, id) cublasCheckStatus(status)
python
def cublasSetStream(handle, id): """ Set current CUBLAS library stream. Parameters ---------- handle : id CUBLAS context. id : int Stream ID. """ status = _libcublas.cublasSetStream_v2(handle, id) cublasCheckStatus(status)
[ "def", "cublasSetStream", "(", "handle", ",", "id", ")", ":", "status", "=", "_libcublas", ".", "cublasSetStream_v2", "(", "handle", ",", "id", ")", "cublasCheckStatus", "(", "status", ")" ]
Set current CUBLAS library stream. Parameters ---------- handle : id CUBLAS context. id : int Stream ID.
[ "Set", "current", "CUBLAS", "library", "stream", ".", "Parameters", "----------", "handle", ":", "id", "CUBLAS", "context", ".", "id", ":", "int", "Stream", "ID", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L251-L265
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasGetStream
def cublasGetStream(handle): """ Set current CUBLAS library stream. Parameters ---------- handle : void_p CUBLAS context. Returns ------- id : int Stream ID. """ id = ctypes.c_int() status = _libcublas.cublasGetStream_v2(handle, ctypes.byref(id)) ...
python
def cublasGetStream(handle): """ Set current CUBLAS library stream. Parameters ---------- handle : void_p CUBLAS context. Returns ------- id : int Stream ID. """ id = ctypes.c_int() status = _libcublas.cublasGetStream_v2(handle, ctypes.byref(id)) ...
[ "def", "cublasGetStream", "(", "handle", ")", ":", "id", "=", "ctypes", ".", "c_int", "(", ")", "status", "=", "_libcublas", ".", "cublasGetStream_v2", "(", "handle", ",", "ctypes", ".", "byref", "(", "id", ")", ")", "cublasCheckStatus", "(", "status", "...
Set current CUBLAS library stream. Parameters ---------- handle : void_p CUBLAS context. Returns ------- id : int Stream ID.
[ "Set", "current", "CUBLAS", "library", "stream", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L270-L289
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasSgbmv
def cublasSgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for real general banded matrix. """ status = _libcublas.cublasSgbmv_v2(handle, trans, m, n, kl, ku, ...
python
def cublasSgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for real general banded matrix. """ status = _libcublas.cublasSgbmv_v2(handle, trans, m, n, kl, ku, ...
[ "def", "cublasSgbmv", "(", "handle", ",", "trans", ",", "m", ",", "n", ",", "kl", ",", "ku", ",", "alpha", ",", "A", ",", "lda", ",", "x", ",", "incx", ",", "beta", ",", "y", ",", "incy", ")", ":", "status", "=", "_libcublas", ".", "cublasSgbmv...
Matrix-vector product for real general banded matrix.
[ "Matrix", "-", "vector", "product", "for", "real", "general", "banded", "matrix", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2071-L2085
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasCgbmv
def cublasCgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex general banded matrix. """ status = _libcublas.cublasCgbmv_v2(handle, trans, m, n, kl, ku, ...
python
def cublasCgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex general banded matrix. """ status = _libcublas.cublasCgbmv_v2(handle, trans, m, n, kl, ku, ...
[ "def", "cublasCgbmv", "(", "handle", ",", "trans", ",", "m", ",", "n", ",", "kl", ",", "ku", ",", "alpha", ",", "A", ",", "lda", ",", "x", ",", "incx", ",", "beta", ",", "y", ",", "incy", ")", ":", "status", "=", "_libcublas", ".", "cublasCgbmv...
Matrix-vector product for complex general banded matrix.
[ "Matrix", "-", "vector", "product", "for", "complex", "general", "banded", "matrix", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2132-L2147
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasZgbmv
def cublasZgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex general banded matrix. """ status = _libcublas.cublasZgbmv_v2(handle, trans, m, n, kl, ku, ...
python
def cublasZgbmv(handle, trans, m, n, kl, ku, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for complex general banded matrix. """ status = _libcublas.cublasZgbmv_v2(handle, trans, m, n, kl, ku, ...
[ "def", "cublasZgbmv", "(", "handle", ",", "trans", ",", "m", ",", "n", ",", "kl", ",", "ku", ",", "alpha", ",", "A", ",", "lda", ",", "x", ",", "incx", ",", "beta", ",", "y", ",", "incy", ")", ":", "status", "=", "_libcublas", ".", "cublasZgbmv...
Matrix-vector product for complex general banded matrix.
[ "Matrix", "-", "vector", "product", "for", "complex", "general", "banded", "matrix", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2163-L2178
hannes-brt/hebel
hebel/pycuda_ops/cublas.py
cublasSgemv
def cublasSgemv(handle, trans, m, n, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for real general matrix. """ status = _libcublas.cublasSgemv_v2(handle, _CUBLAS_OP[trans], m, n, ctypes.byref(ctypes.c_fl...
python
def cublasSgemv(handle, trans, m, n, alpha, A, lda, x, incx, beta, y, incy): """ Matrix-vector product for real general matrix. """ status = _libcublas.cublasSgemv_v2(handle, _CUBLAS_OP[trans], m, n, ctypes.byref(ctypes.c_fl...
[ "def", "cublasSgemv", "(", "handle", ",", "trans", ",", "m", ",", "n", ",", "alpha", ",", "A", ",", "lda", ",", "x", ",", "incx", ",", "beta", ",", "y", ",", "incy", ")", ":", "status", "=", "_libcublas", ".", "cublasSgemv_v2", "(", "handle", ","...
Matrix-vector product for real general matrix.
[ "Matrix", "-", "vector", "product", "for", "real", "general", "matrix", "." ]
train
https://github.com/hannes-brt/hebel/blob/1e2c3a9309c2646103901b26a55be4e312dd5005/hebel/pycuda_ops/cublas.py#L2253-L2264