hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
db948112d380555a98c8be0467602650996d7a35
AIPYX/theano
theano/sandbox/rng_mrg.py
[ "BSD-3-Clause" ]
Python
uniform
<not_specific>
def uniform(self, size, low=0.0, high=1.0, ndim=None, dtype=None, nstreams=None, **kwargs): # TODO : need description for parameter 'size', 'ndim', 'nstreams' """ Sample a tensor of given size whose element from a uniform distribution between low and high. If the...
Sample a tensor of given size whose element from a uniform distribution between low and high. If the size argument is ambiguous on the number of dimensions, ndim may be a plain integer to supplement the missing information. Parameters ---------- low ...
Sample a tensor of given size whose element from a uniform distribution between low and high. If the size argument is ambiguous on the number of dimensions, ndim may be a plain integer to supplement the missing information. Parameters low Lower bound of the interval on which values are sampled.
[ "Sample", "a", "tensor", "of", "given", "size", "whose", "element", "from", "a", "uniform", "distribution", "between", "low", "and", "high", ".", "If", "the", "size", "argument", "is", "ambiguous", "on", "the", "number", "of", "dimensions", "ndim", "may", ...
def uniform(self, size, low=0.0, high=1.0, ndim=None, dtype=None, nstreams=None, **kwargs): low = as_tensor_variable(low) high = as_tensor_variable(high) if dtype is None: dtype = scal.upcast(config.floatX, low.dtype, high.dtype) low = cast(low, dtype=dtype) ...
[ "def", "uniform", "(", "self", ",", "size", ",", "low", "=", "0.0", ",", "high", "=", "1.0", ",", "ndim", "=", "None", ",", "dtype", "=", "None", ",", "nstreams", "=", "None", ",", "**", "kwargs", ")", ":", "low", "=", "as_tensor_variable", "(", ...
Sample a tensor of given size whose element from a uniform distribution between low and high.
[ "Sample", "a", "tensor", "of", "given", "size", "whose", "element", "from", "a", "uniform", "distribution", "between", "low", "and", "high", "." ]
[ "# TODO : need description for parameter 'size', 'ndim', 'nstreams'", "\"\"\"\n Sample a tensor of given size whose element from a uniform\n distribution between low and high.\n\n If the size argument is ambiguous on the number of dimensions,\n ndim may be a plain integer to supplement...
[ { "param": "self", "type": null }, { "param": "size", "type": null }, { "param": "low", "type": null }, { "param": "high", "type": null }, { "param": "ndim", "type": null }, { "param": "dtype", "type": null }, { "param": "nstreams", "ty...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": [...
db948112d380555a98c8be0467602650996d7a35
AIPYX/theano
theano/sandbox/rng_mrg.py
[ "BSD-3-Clause" ]
Python
normal
<not_specific>
def normal(self, size, avg=0.0, std=1.0, ndim=None, dtype=None, nstreams=None, truncate=False, **kwargs): """ Sample a tensor of values from a normal distribution. Parameters ---------- size : int_vector_like Array dimensions for the output tensor. ...
Sample a tensor of values from a normal distribution. Parameters ---------- size : int_vector_like Array dimensions for the output tensor. avg : float_like, optional The mean value for the truncated normal to sample from (defaults to 0.0). std : ...
Sample a tensor of values from a normal distribution. Parameters size : int_vector_like Array dimensions for the output tensor. avg : float_like, optional The mean value for the truncated normal to sample from (defaults to 0.0). std : float_like, optional The standard deviation for the truncated normal to sample from ...
[ "Sample", "a", "tensor", "of", "values", "from", "a", "normal", "distribution", ".", "Parameters", "size", ":", "int_vector_like", "Array", "dimensions", "for", "the", "output", "tensor", ".", "avg", ":", "float_like", "optional", "The", "mean", "value", "for"...
def normal(self, size, avg=0.0, std=1.0, ndim=None, dtype=None, nstreams=None, truncate=False, **kwargs): size = _check_size(size) avg = undefined_grad(as_tensor_variable(avg)) std = undefined_grad(as_tensor_variable(std)) if dtype is None: dtype = scal.upcast(...
[ "def", "normal", "(", "self", ",", "size", ",", "avg", "=", "0.0", ",", "std", "=", "1.0", ",", "ndim", "=", "None", ",", "dtype", "=", "None", ",", "nstreams", "=", "None", ",", "truncate", "=", "False", ",", "**", "kwargs", ")", ":", "size", ...
Sample a tensor of values from a normal distribution.
[ "Sample", "a", "tensor", "of", "values", "from", "a", "normal", "distribution", "." ]
[ "\"\"\"\n Sample a tensor of values from a normal distribution.\n\n Parameters\n ----------\n size : int_vector_like\n Array dimensions for the output tensor.\n avg : float_like, optional\n The mean value for the truncated normal to sample from (defaults to 0...
[ { "param": "self", "type": null }, { "param": "size", "type": null }, { "param": "avg", "type": null }, { "param": "std", "type": null }, { "param": "ndim", "type": null }, { "param": "dtype", "type": null }, { "param": "nstreams", "typ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": [...
db948112d380555a98c8be0467602650996d7a35
AIPYX/theano
theano/sandbox/rng_mrg.py
[ "BSD-3-Clause" ]
Python
truncated_normal
<not_specific>
def truncated_normal(self, size, avg=0.0, std=1.0, ndim=None, dtype=None, nstreams=None, **kwargs): """ Sample a tensor of values from a symmetrically truncated normal distribution. Parameters ---------- size : int_vector_like Array dimension...
Sample a tensor of values from a symmetrically truncated normal distribution. Parameters ---------- size : int_vector_like Array dimensions for the output tensor. avg : float_like, optional The mean value for the truncated normal to sample from (defaults...
Sample a tensor of values from a symmetrically truncated normal distribution. Parameters size : int_vector_like Array dimensions for the output tensor. avg : float_like, optional The mean value for the truncated normal to sample from (defaults to 0.0). std : float_like, optional The standard deviation for the truncate...
[ "Sample", "a", "tensor", "of", "values", "from", "a", "symmetrically", "truncated", "normal", "distribution", ".", "Parameters", "size", ":", "int_vector_like", "Array", "dimensions", "for", "the", "output", "tensor", ".", "avg", ":", "float_like", "optional", "...
def truncated_normal(self, size, avg=0.0, std=1.0, ndim=None, dtype=None, nstreams=None, **kwargs): std = std / tensor.constant(.87962566103423978) return self.normal(size=size, avg=avg, std=std, truncate=True, ndim=ndim, dtype=dtype, nstreams=nstreams...
[ "def", "truncated_normal", "(", "self", ",", "size", ",", "avg", "=", "0.0", ",", "std", "=", "1.0", ",", "ndim", "=", "None", ",", "dtype", "=", "None", ",", "nstreams", "=", "None", ",", "**", "kwargs", ")", ":", "std", "=", "std", "/", "tensor...
Sample a tensor of values from a symmetrically truncated normal distribution.
[ "Sample", "a", "tensor", "of", "values", "from", "a", "symmetrically", "truncated", "normal", "distribution", "." ]
[ "\"\"\"\n Sample a tensor of values from a symmetrically truncated normal distribution.\n\n Parameters\n ----------\n size : int_vector_like\n Array dimensions for the output tensor.\n avg : float_like, optional\n The mean value for the truncated normal to sa...
[ { "param": "self", "type": null }, { "param": "size", "type": null }, { "param": "avg", "type": null }, { "param": "std", "type": null }, { "param": "ndim", "type": null }, { "param": "dtype", "type": null }, { "param": "nstreams", "typ...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": [...
db948112d380555a98c8be0467602650996d7a35
AIPYX/theano
theano/sandbox/rng_mrg.py
[ "BSD-3-Clause" ]
Python
_check_size
<not_specific>
def _check_size(size): """ Canonicalise inputs to get valid output sizes for Theano tensors. Parameters ---------- size : int_vector_like Some variable that could serve as the shape for a Theano tensor. This can be an int, a tuple of ints, a list of ints or a Theano Variable...
Canonicalise inputs to get valid output sizes for Theano tensors. Parameters ---------- size : int_vector_like Some variable that could serve as the shape for a Theano tensor. This can be an int, a tuple of ints, a list of ints or a Theano Variable with similar properties. ...
Canonicalise inputs to get valid output sizes for Theano tensors. Parameters size : int_vector_like Some variable that could serve as the shape for a Theano tensor. This can be an int, a tuple of ints, a list of ints or a Theano Variable with similar properties. Returns size_var : int_vector A one-dimensional Theano...
[ "Canonicalise", "inputs", "to", "get", "valid", "output", "sizes", "for", "Theano", "tensors", ".", "Parameters", "size", ":", "int_vector_like", "Some", "variable", "that", "could", "serve", "as", "the", "shape", "for", "a", "Theano", "tensor", ".", "This", ...
def _check_size(size): if isinstance(size, theano.Variable): if size.ndim == 1: return size elif size.ndim == 0: return tensor.stack([size], ndim=1) else: raise ValueError("Theano variable must have 1 dimension to be a valid size.", size) elif isinstan...
[ "def", "_check_size", "(", "size", ")", ":", "if", "isinstance", "(", "size", ",", "theano", ".", "Variable", ")", ":", "if", "size", ".", "ndim", "==", "1", ":", "return", "size", "elif", "size", ".", "ndim", "==", "0", ":", "return", "tensor", "....
Canonicalise inputs to get valid output sizes for Theano tensors.
[ "Canonicalise", "inputs", "to", "get", "valid", "output", "sizes", "for", "Theano", "tensors", "." ]
[ "\"\"\"\n Canonicalise inputs to get valid output sizes for Theano tensors.\n\n Parameters\n ----------\n size : int_vector_like\n Some variable that could serve as the shape for a Theano tensor.\n This can be an int, a tuple of ints, a list of ints\n or a Theano Variable with simil...
[ { "param": "size", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "size", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
50786aefdd503a5233705cbb847d6b8bd167b961
AIPYX/theano
theano/compile/builders.py
[ "BSD-3-Clause" ]
Python
_recompute_lop_op
<not_specific>
def _recompute_lop_op(self): ''' converts self._lop_op from user supplied form to type(self) instance ''' local_inputs = self.local_inputs local_outputs = self.local_outputs inp_len = len(local_inputs) lop_op = self._lop_op if isinstance(lop_op, OpFromGr...
converts self._lop_op from user supplied form to type(self) instance
converts self._lop_op from user supplied form to type(self) instance
[ "converts", "self", ".", "_lop_op", "from", "user", "supplied", "form", "to", "type", "(", "self", ")", "instance" ]
def _recompute_lop_op(self): local_inputs = self.local_inputs local_outputs = self.local_outputs inp_len = len(local_inputs) lop_op = self._lop_op if isinstance(lop_op, OpFromGraph): if self._lop_op_is_cached: return assert self._lop_type i...
[ "def", "_recompute_lop_op", "(", "self", ")", ":", "local_inputs", "=", "self", ".", "local_inputs", "local_outputs", "=", "self", ".", "local_outputs", "inp_len", "=", "len", "(", "local_inputs", ")", "lop_op", "=", "self", ".", "_lop_op", "if", "isinstance",...
converts self._lop_op from user supplied form to type(self) instance
[ "converts", "self", ".", "_lop_op", "from", "user", "supplied", "form", "to", "type", "(", "self", ")", "instance" ]
[ "'''\n converts self._lop_op from user supplied form to type(self) instance\n\n '''", "# make a wrapper callable", "# OfG can be directly used in L_op format", "# we need to convert _lop_op into an OfG instance", "# compute non-overriding downsteam grads from upstreams grads", "# it's normal...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
50786aefdd503a5233705cbb847d6b8bd167b961
AIPYX/theano
theano/compile/builders.py
[ "BSD-3-Clause" ]
Python
_recompute_rop_op
<not_specific>
def _recompute_rop_op(self): ''' converts self._rop_op from user supplied form to type(self) instance ''' local_inputs = self.local_inputs local_outputs = self.local_outputs out_len = len(local_outputs) rop_op = self._rop_op if isinstance(rop_op, OpFromG...
converts self._rop_op from user supplied form to type(self) instance
converts self._rop_op from user supplied form to type(self) instance
[ "converts", "self", ".", "_rop_op", "from", "user", "supplied", "form", "to", "type", "(", "self", ")", "instance" ]
def _recompute_rop_op(self): local_inputs = self.local_inputs local_outputs = self.local_outputs out_len = len(local_outputs) rop_op = self._rop_op if isinstance(rop_op, OpFromGraph): if not self._rop_op_is_cached: self._rop_op_is_cached = True ...
[ "def", "_recompute_rop_op", "(", "self", ")", ":", "local_inputs", "=", "self", ".", "local_inputs", "local_outputs", "=", "self", ".", "local_outputs", "out_len", "=", "len", "(", "local_outputs", ")", "rop_op", "=", "self", ".", "_rop_op", "if", "isinstance"...
converts self._rop_op from user supplied form to type(self) instance
[ "converts", "self", ".", "_rop_op", "from", "user", "supplied", "form", "to", "type", "(", "self", ")", "instance" ]
[ "'''\n converts self._rop_op from user supplied form to type(self) instance\n\n '''", "# get outputs that does not have Rop override", "# combine overriding Rops" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
50786aefdd503a5233705cbb847d6b8bd167b961
AIPYX/theano
theano/compile/builders.py
[ "BSD-3-Clause" ]
Python
connection_pattern
<not_specific>
def connection_pattern(self, node): """ Return connection pattern of subfgraph defined by inputs and outputs. """ if self._connection_pattern is not None: return self._connection_pattern inp_len = len(self.local_inputs) out_len = len(self.local_outputs) ...
Return connection pattern of subfgraph defined by inputs and outputs.
Return connection pattern of subfgraph defined by inputs and outputs.
[ "Return", "connection", "pattern", "of", "subfgraph", "defined", "by", "inputs", "and", "outputs", "." ]
def connection_pattern(self, node): if self._connection_pattern is not None: return self._connection_pattern inp_len = len(self.local_inputs) out_len = len(self.local_outputs) cpmat_self = io_connection_pattern( self.local_inputs, self.local_outputs) lop_o...
[ "def", "connection_pattern", "(", "self", ",", "node", ")", ":", "if", "self", ".", "_connection_pattern", "is", "not", "None", ":", "return", "self", ".", "_connection_pattern", "inp_len", "=", "len", "(", "self", ".", "local_inputs", ")", "out_len", "=", ...
Return connection pattern of subfgraph defined by inputs and outputs.
[ "Return", "connection", "pattern", "of", "subfgraph", "defined", "by", "inputs", "and", "outputs", "." ]
[ "\"\"\"\n Return connection pattern of subfgraph defined by inputs and outputs.\n\n \"\"\"", "# cpmat_self |= cpmat_grad.T", "# cpmat_self &= out_is_disconnected", "# TODO in case DisconnectedType is implemented for R_op,", "# self._rop_op_stypes_l self._rop_op should considered for", "# con...
[ { "param": "self", "type": null }, { "param": "node", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
50786aefdd503a5233705cbb847d6b8bd167b961
AIPYX/theano
theano/compile/builders.py
[ "BSD-3-Clause" ]
Python
inline_ofg_expansion
<not_specific>
def inline_ofg_expansion(node): """ This optimization expands internal graph of OpFromGraph. Only performed if node.op.is_inline == True Doing so can improve optimization at the cost of compilation speed. """ op = node.op if not isinstance(op, OpFromGraph): return False if not op...
This optimization expands internal graph of OpFromGraph. Only performed if node.op.is_inline == True Doing so can improve optimization at the cost of compilation speed.
This optimization expands internal graph of OpFromGraph. Only performed if node.op.is_inline == True Doing so can improve optimization at the cost of compilation speed.
[ "This", "optimization", "expands", "internal", "graph", "of", "OpFromGraph", ".", "Only", "performed", "if", "node", ".", "op", ".", "is_inline", "==", "True", "Doing", "so", "can", "improve", "optimization", "at", "the", "cost", "of", "compilation", "speed", ...
def inline_ofg_expansion(node): op = node.op if not isinstance(op, OpFromGraph): return False if not op.is_inline: return False return theano.clone( op.local_outputs, { u: v for u, v in izip( node.op.local_inputs, node.inputs)})
[ "def", "inline_ofg_expansion", "(", "node", ")", ":", "op", "=", "node", ".", "op", "if", "not", "isinstance", "(", "op", ",", "OpFromGraph", ")", ":", "return", "False", "if", "not", "op", ".", "is_inline", ":", "return", "False", "return", "theano", ...
This optimization expands internal graph of OpFromGraph.
[ "This", "optimization", "expands", "internal", "graph", "of", "OpFromGraph", "." ]
[ "\"\"\"\n This optimization expands internal graph of OpFromGraph.\n Only performed if node.op.is_inline == True\n Doing so can improve optimization at the cost of compilation speed.\n \"\"\"" ]
[ { "param": "node", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
safe_no_dnn_workmem
<not_specific>
def safe_no_dnn_workmem(workmem): """ Make sure the user is not attempting to use dnn.conv.workmem`. """ if workmem: raise RuntimeError( 'The option `dnn.conv.workmem` has been removed and should ' 'not be used anymore. Please use the option ' '`dnn.conv.algo_...
Make sure the user is not attempting to use dnn.conv.workmem`.
Make sure the user is not attempting to use dnn.conv.workmem`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "workmem", "`", "." ]
def safe_no_dnn_workmem(workmem): if workmem: raise RuntimeError( 'The option `dnn.conv.workmem` has been removed and should ' 'not be used anymore. Please use the option ' '`dnn.conv.algo_fwd` instead.') return True
[ "def", "safe_no_dnn_workmem", "(", "workmem", ")", ":", "if", "workmem", ":", "raise", "RuntimeError", "(", "'The option `dnn.conv.workmem` has been removed and should '", "'not be used anymore. Please use the option '", "'`dnn.conv.algo_fwd` instead.'", ")", "return", "True" ]
Make sure the user is not attempting to use dnn.conv.workmem`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "workmem", "`", "." ]
[ "\"\"\"\n Make sure the user is not attempting to use dnn.conv.workmem`.\n \"\"\"" ]
[ { "param": "workmem", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "workmem", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
safe_no_dnn_workmem_bwd
<not_specific>
def safe_no_dnn_workmem_bwd(workmem): """ Make sure the user is not attempting to use dnn.conv.workmem_bwd`. """ if workmem: raise RuntimeError( 'The option `dnn.conv.workmem_bwd` has been removed and ' 'should not be used anymore. Please use the options ' '`d...
Make sure the user is not attempting to use dnn.conv.workmem_bwd`.
Make sure the user is not attempting to use dnn.conv.workmem_bwd`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "workmem_bwd", "`", "." ]
def safe_no_dnn_workmem_bwd(workmem): if workmem: raise RuntimeError( 'The option `dnn.conv.workmem_bwd` has been removed and ' 'should not be used anymore. Please use the options ' '`dnn.conv.algo_bwd_filter` and `dnn.conv.algo_bwd_data` instead.') return True
[ "def", "safe_no_dnn_workmem_bwd", "(", "workmem", ")", ":", "if", "workmem", ":", "raise", "RuntimeError", "(", "'The option `dnn.conv.workmem_bwd` has been removed and '", "'should not be used anymore. Please use the options '", "'`dnn.conv.algo_bwd_filter` and `dnn.conv.algo_bwd_data` ...
Make sure the user is not attempting to use dnn.conv.workmem_bwd`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "workmem_bwd", "`", "." ]
[ "\"\"\"\n Make sure the user is not attempting to use dnn.conv.workmem_bwd`.\n \"\"\"" ]
[ { "param": "workmem", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "workmem", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
safe_no_dnn_algo_bwd
<not_specific>
def safe_no_dnn_algo_bwd(algo): """ Make sure the user is not attempting to use dnn.conv.algo_bwd`. """ if algo: raise RuntimeError( 'The option `dnn.conv.algo_bwd` has been removed and ' 'should not be used anymore. Please use the options ' '`dnn.conv.algo_bw...
Make sure the user is not attempting to use dnn.conv.algo_bwd`.
Make sure the user is not attempting to use dnn.conv.algo_bwd`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "algo_bwd", "`", "." ]
def safe_no_dnn_algo_bwd(algo): if algo: raise RuntimeError( 'The option `dnn.conv.algo_bwd` has been removed and ' 'should not be used anymore. Please use the options ' '`dnn.conv.algo_bwd_filter` and `dnn.conv.algo_bwd_data` instead.') return True
[ "def", "safe_no_dnn_algo_bwd", "(", "algo", ")", ":", "if", "algo", ":", "raise", "RuntimeError", "(", "'The option `dnn.conv.algo_bwd` has been removed and '", "'should not be used anymore. Please use the options '", "'`dnn.conv.algo_bwd_filter` and `dnn.conv.algo_bwd_data` instead.'", ...
Make sure the user is not attempting to use dnn.conv.algo_bwd`.
[ "Make", "sure", "the", "user", "is", "not", "attempting", "to", "use", "dnn", ".", "conv", ".", "algo_bwd", "`", "." ]
[ "\"\"\"\n Make sure the user is not attempting to use dnn.conv.algo_bwd`.\n \"\"\"" ]
[ { "param": "algo", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "algo", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
split_version
<not_specific>
def split_version(version): """ Take version as a dot-separated string, return a tuple of int """ return tuple(int(i) for i in version.split('.'))
Take version as a dot-separated string, return a tuple of int
Take version as a dot-separated string, return a tuple of int
[ "Take", "version", "as", "a", "dot", "-", "separated", "string", "return", "a", "tuple", "of", "int" ]
def split_version(version): return tuple(int(i) for i in version.split('.'))
[ "def", "split_version", "(", "version", ")", ":", "return", "tuple", "(", "int", "(", "i", ")", "for", "i", "in", "version", ".", "split", "(", "'.'", ")", ")" ]
Take version as a dot-separated string, return a tuple of int
[ "Take", "version", "as", "a", "dot", "-", "separated", "string", "return", "a", "tuple", "of", "int" ]
[ "\"\"\"\n Take version as a dot-separated string, return a tuple of int\n \"\"\"" ]
[ { "param": "version", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "version", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
warn_default
<not_specific>
def warn_default(version): """ Return True iff we should warn about bugs fixed after a given version. """ if config.warn.ignore_bug_before == 'None': return True if config.warn.ignore_bug_before == 'all': return False if (split_version(config.warn.ignore_bug_before) >= ...
Return True iff we should warn about bugs fixed after a given version.
Return True iff we should warn about bugs fixed after a given version.
[ "Return", "True", "iff", "we", "should", "warn", "about", "bugs", "fixed", "after", "a", "given", "version", "." ]
def warn_default(version): if config.warn.ignore_bug_before == 'None': return True if config.warn.ignore_bug_before == 'all': return False if (split_version(config.warn.ignore_bug_before) >= split_version(version)): return False return True
[ "def", "warn_default", "(", "version", ")", ":", "if", "config", ".", "warn", ".", "ignore_bug_before", "==", "'None'", ":", "return", "True", "if", "config", ".", "warn", ".", "ignore_bug_before", "==", "'all'", ":", "return", "False", "if", "(", "split_v...
Return True iff we should warn about bugs fixed after a given version.
[ "Return", "True", "iff", "we", "should", "warn", "about", "bugs", "fixed", "after", "a", "given", "version", "." ]
[ "\"\"\"\n Return True iff we should warn about bugs fixed after a given version.\n \"\"\"" ]
[ { "param": "version", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "version", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bc299737c48c479389ad4bd10a5613e66f8bc087
AIPYX/theano
theano/configdefaults.py
[ "BSD-3-Clause" ]
Python
short_platform
<not_specific>
def short_platform(r=None, p=None): """ Return a safe shorter version of platform.platform(). The old default Theano compiledir used platform.platform in it. This use the platform.version() as a substring. This is too specific as it contain the full kernel number and package version. This cause...
Return a safe shorter version of platform.platform(). The old default Theano compiledir used platform.platform in it. This use the platform.version() as a substring. This is too specific as it contain the full kernel number and package version. This cause the compiledir to change each time there i...
Return a safe shorter version of platform.platform(). The old default Theano compiledir used platform.platform in it. This use the platform.version() as a substring. This is too specific as it contain the full kernel number and package version. This cause the compiledir to change each time there is a new linux kernel u...
[ "Return", "a", "safe", "shorter", "version", "of", "platform", ".", "platform", "()", ".", "The", "old", "default", "Theano", "compiledir", "used", "platform", ".", "platform", "in", "it", ".", "This", "use", "the", "platform", ".", "version", "()", "as", ...
def short_platform(r=None, p=None): if r is None: r = platform.release() if p is None: p = platform.platform() sp = r.split('-') if len(sp) < 2: return p kernel_version = sp[0].split('.') if len(kernel_version) <= 2: return p sp[0] = '.'.join(kernel_version[:2...
[ "def", "short_platform", "(", "r", "=", "None", ",", "p", "=", "None", ")", ":", "if", "r", "is", "None", ":", "r", "=", "platform", ".", "release", "(", ")", "if", "p", "is", "None", ":", "p", "=", "platform", ".", "platform", "(", ")", "sp", ...
Return a safe shorter version of platform.platform().
[ "Return", "a", "safe", "shorter", "version", "of", "platform", ".", "platform", "()", "." ]
[ "\"\"\"\n Return a safe shorter version of platform.platform().\n\n The old default Theano compiledir used platform.platform in\n it. This use the platform.version() as a substring. This is too\n specific as it contain the full kernel number and package\n version. This cause the compiledir to change ...
[ { "param": "r", "type": null }, { "param": "p", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "r", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "p", "type": null, "docstring": null, "docstring_tokens": [], ...
c3ca399613b88543f8234ad950da5a0343a474a4
AIPYX/theano
theano/gof/utils.py
[ "BSD-3-Clause" ]
Python
hash_from_file
<not_specific>
def hash_from_file(file_path): """ Return the SHA256 hash of a file. """ with open(file_path, 'rb') as f: file_content = f.read() return hash_from_code(file_content)
Return the SHA256 hash of a file.
Return the SHA256 hash of a file.
[ "Return", "the", "SHA256", "hash", "of", "a", "file", "." ]
def hash_from_file(file_path): with open(file_path, 'rb') as f: file_content = f.read() return hash_from_code(file_content)
[ "def", "hash_from_file", "(", "file_path", ")", ":", "with", "open", "(", "file_path", ",", "'rb'", ")", "as", "f", ":", "file_content", "=", "f", ".", "read", "(", ")", "return", "hash_from_code", "(", "file_content", ")" ]
Return the SHA256 hash of a file.
[ "Return", "the", "SHA256", "hash", "of", "a", "file", "." ]
[ "\"\"\"\n Return the SHA256 hash of a file.\n\n \"\"\"" ]
[ { "param": "file_path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file_path", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_header_dirs
null
def c_header_dirs(self): """ Optional: Return a list of header search paths required by code returned by this class. Examples -------- return ['/usr/local/include', '/opt/weirdpath/src/include'] Provides search paths for headers, in addition to those in any rele...
Optional: Return a list of header search paths required by code returned by this class. Examples -------- return ['/usr/local/include', '/opt/weirdpath/src/include'] Provides search paths for headers, in addition to those in any relevant environment variables. ...
Return a list of header search paths required by code returned by this class. Examples Provides search paths for headers, in addition to those in any relevant environment variables. for unix compilers, these are the things that get '-I' prefixed in the compiler cmdline. Raises MethodNotDefined Subclass does not ...
[ "Return", "a", "list", "of", "header", "search", "paths", "required", "by", "code", "returned", "by", "this", "class", ".", "Examples", "Provides", "search", "paths", "for", "headers", "in", "addition", "to", "those", "in", "any", "relevant", "environment", ...
def c_header_dirs(self): raise utils.MethodNotDefined( "c_header_dirs", type(self), self.__class__.__name__)
[ "def", "c_header_dirs", "(", "self", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_header_dirs\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: Return a list of header search paths required by code returned by this class.
[ "Optional", ":", "Return", "a", "list", "of", "header", "search", "paths", "required", "by", "code", "returned", "by", "this", "class", "." ]
[ "\"\"\"\n Optional: Return a list of header search paths required by code\n returned by this class.\n\n Examples\n --------\n return ['/usr/local/include', '/opt/weirdpath/src/include']\n\n Provides search paths for headers, in addition to those in any relevant\n env...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_libraries
null
def c_libraries(self): """ Optional: Return a list of libraries required by code returned by this class. Examples -------- return ['gsl', 'gslcblas', 'm', 'fftw3', 'g2c']. The compiler will search the directories specified by the environment variable LD_...
Optional: Return a list of libraries required by code returned by this class. Examples -------- return ['gsl', 'gslcblas', 'm', 'fftw3', 'g2c']. The compiler will search the directories specified by the environment variable LD_LIBRARY_PATH in addition to any re...
Return a list of libraries required by code returned by this class. Examples The compiler will search the directories specified by the environment variable LD_LIBRARY_PATH in addition to any returned by `c_lib_dirs`. for unix compilers, these are the things that get '-l' prefixed in the compiler cmdline. Raises ...
[ "Return", "a", "list", "of", "libraries", "required", "by", "code", "returned", "by", "this", "class", ".", "Examples", "The", "compiler", "will", "search", "the", "directories", "specified", "by", "the", "environment", "variable", "LD_LIBRARY_PATH", "in", "addi...
def c_libraries(self): raise utils.MethodNotDefined( "c_libraries", type(self), self.__class__.__name__)
[ "def", "c_libraries", "(", "self", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_libraries\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: Return a list of libraries required by code returned by this class.
[ "Optional", ":", "Return", "a", "list", "of", "libraries", "required", "by", "code", "returned", "by", "this", "class", "." ]
[ "\"\"\"\n Optional: Return a list of libraries required by code returned by\n this class.\n\n Examples\n --------\n return ['gsl', 'gslcblas', 'm', 'fftw3', 'g2c'].\n\n The compiler will search the directories specified by the environment\n variable LD_LIBRARY_PATH i...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_lib_dirs
null
def c_lib_dirs(self): """ Optional: Return a list of library search paths required by code returned by this class. Examples -------- return ['/usr/local/lib', '/opt/weirdpath/build/libs']. Provides search paths for libraries, in addition to those in any ...
Optional: Return a list of library search paths required by code returned by this class. Examples -------- return ['/usr/local/lib', '/opt/weirdpath/build/libs']. Provides search paths for libraries, in addition to those in any relevant environment variables (e...
Return a list of library search paths required by code returned by this class. Examples Provides search paths for libraries, in addition to those in any relevant environment variables . for unix compilers, these are the things that get '-L' prefixed in the compiler cmdline. Raises MethodNotDefined Subclass does ...
[ "Return", "a", "list", "of", "library", "search", "paths", "required", "by", "code", "returned", "by", "this", "class", ".", "Examples", "Provides", "search", "paths", "for", "libraries", "in", "addition", "to", "those", "in", "any", "relevant", "environment",...
def c_lib_dirs(self): raise utils.MethodNotDefined( "c_lib_dirs", type(self), self.__class__.__name__)
[ "def", "c_lib_dirs", "(", "self", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_lib_dirs\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: Return a list of library search paths required by code returned by this class.
[ "Optional", ":", "Return", "a", "list", "of", "library", "search", "paths", "required", "by", "code", "returned", "by", "this", "class", "." ]
[ "\"\"\"\n Optional: Return a list of library search paths required by code\n returned by this class.\n\n Examples\n --------\n return ['/usr/local/lib', '/opt/weirdpath/build/libs'].\n\n Provides search paths for libraries, in addition to those in any\n relevant envi...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_support_code
null
def c_support_code(self): """ Optional: Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be included at global scope prior to the rest of the code for this class. QUESTION: How many times will this support code be emitted for a graph with m...
Optional: Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be included at global scope prior to the rest of the code for this class. QUESTION: How many times will this support code be emitted for a graph with many instances of the same type? ...
Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be included at global scope prior to the rest of the code for this class. Raises MethodNotDefined Subclass does not implement this method.
[ "Return", "utility", "code", "(", "a", "string", "or", "a", "list", "of", "strings", ")", "for", "use", "by", "a", "`", "Variable", "`", "or", "`", "Op", "`", "to", "be", "included", "at", "global", "scope", "prior", "to", "the", "rest", "of", "the...
def c_support_code(self): raise utils.MethodNotDefined( "c_support_code", type(self), self.__class__.__name__)
[ "def", "c_support_code", "(", "self", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_support_code\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be included at global scope prior to the rest of the code for this class.
[ "Optional", ":", "Return", "utility", "code", "(", "a", "string", "or", "a", "list", "of", "strings", ")", "for", "use", "by", "a", "`", "Variable", "`", "or", "`", "Op", "`", "to", "be", "included", "at", "global", "scope", "prior", "to", "the", "...
[ "\"\"\"\n Optional: Return utility code (a string, or a list of strings) for use by a `Variable` or `Op` to be\n included at global scope prior to the rest of the code for this class.\n\n QUESTION: How many times will this support code be emitted for a graph\n with many instances of the ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_no_compile_args
null
def c_no_compile_args(self): """ Optional: return a list of incompatible gcc compiler arguments. We will remove those arguments from the command line of gcc. So if another Op adds a compile arg in the graph that is incompatible with this Op, the incompatible arg will not be used...
Optional: return a list of incompatible gcc compiler arguments. We will remove those arguments from the command line of gcc. So if another Op adds a compile arg in the graph that is incompatible with this Op, the incompatible arg will not be used. Useful for instance to remove ...
return a list of incompatible gcc compiler arguments. We will remove those arguments from the command line of gcc. So if another Op adds a compile arg in the graph that is incompatible with this Op, the incompatible arg will not be used. Useful for instance to remove -ffast-math. EXAMPLE WRITEME Raises MethodNotDef...
[ "return", "a", "list", "of", "incompatible", "gcc", "compiler", "arguments", ".", "We", "will", "remove", "those", "arguments", "from", "the", "command", "line", "of", "gcc", ".", "So", "if", "another", "Op", "adds", "a", "compile", "arg", "in", "the", "...
def c_no_compile_args(self): raise utils.MethodNotDefined( "c_no_compile_args", type(self), self.__class__.__name__)
[ "def", "c_no_compile_args", "(", "self", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_no_compile_args\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return a list of incompatible gcc compiler arguments.
[ "Optional", ":", "return", "a", "list", "of", "incompatible", "gcc", "compiler", "arguments", "." ]
[ "\"\"\"\n Optional: return a list of incompatible gcc compiler arguments.\n\n We will remove those arguments from the command line of gcc. So if\n another Op adds a compile arg in the graph that is incompatible\n with this Op, the incompatible arg will not be used.\n Useful for in...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_code
null
def c_code(self, node, name, inputs, outputs, sub): """ Required: return the C implementation of an Op. Returns C code that does the computation associated to this `Op`, given names for the inputs and outputs. Parameters ---------- node : Apply instance ...
Required: return the C implementation of an Op. Returns C code that does the computation associated to this `Op`, given names for the inputs and outputs. Parameters ---------- node : Apply instance The node for which we are compiling the current c_code. ...
return the C implementation of an Op. Returns C code that does the computation associated to this `Op`, given names for the inputs and outputs. Parameters node : Apply instance The node for which we are compiling the current c_code. The same Op may be used in more than one node. name : str A name that is automaticall...
[ "return", "the", "C", "implementation", "of", "an", "Op", ".", "Returns", "C", "code", "that", "does", "the", "computation", "associated", "to", "this", "`", "Op", "`", "given", "names", "for", "the", "inputs", "and", "outputs", ".", "Parameters", "node", ...
def c_code(self, node, name, inputs, outputs, sub): raise utils.MethodNotDefined('%s.c_code' % self.__class__.__name__)
[ "def", "c_code", "(", "self", ",", "node", ",", "name", ",", "inputs", ",", "outputs", ",", "sub", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "'%s.c_code'", "%", "self", ".", "__class__", ".", "__name__", ")" ]
Required: return the C implementation of an Op.
[ "Required", ":", "return", "the", "C", "implementation", "of", "an", "Op", "." ]
[ "\"\"\"\n Required: return the C implementation of an Op.\n\n Returns C code that does the computation associated to this `Op`,\n given names for the inputs and outputs.\n\n Parameters\n ----------\n node : Apply instance\n The node for which we are compiling the...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null }, { "param": "inputs", "type": null }, { "param": "outputs", "type": null }, { "param": "sub", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_code_cleanup
null
def c_code_cleanup(self, node, name, inputs, outputs, sub): """ Optional: return C code to run after c_code, whether it failed or not. This is a convenient place to clean up things allocated by c_code(). Parameters ---------- node : Apply instance WRITEME ...
Optional: return C code to run after c_code, whether it failed or not. This is a convenient place to clean up things allocated by c_code(). Parameters ---------- node : Apply instance WRITEME name : str A name that is automatically assigned and ...
return C code to run after c_code, whether it failed or not. This is a convenient place to clean up things allocated by c_code(). Parameters node : Apply instance WRITEME name : str A name that is automatically assigned and guaranteed to be unique. inputs : list of strings There is a string for each input of the func...
[ "return", "C", "code", "to", "run", "after", "c_code", "whether", "it", "failed", "or", "not", ".", "This", "is", "a", "convenient", "place", "to", "clean", "up", "things", "allocated", "by", "c_code", "()", ".", "Parameters", "node", ":", "Apply", "inst...
def c_code_cleanup(self, node, name, inputs, outputs, sub): raise utils.MethodNotDefined('%s.c_code_cleanup' % self.__class__.__name__)
[ "def", "c_code_cleanup", "(", "self", ",", "node", ",", "name", ",", "inputs", ",", "outputs", ",", "sub", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "'%s.c_code_cleanup'", "%", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return C code to run after c_code, whether it failed or not.
[ "Optional", ":", "return", "C", "code", "to", "run", "after", "c_code", "whether", "it", "failed", "or", "not", "." ]
[ "\"\"\"\n Optional: return C code to run after c_code, whether it failed or not.\n\n This is a convenient place to clean up things allocated by c_code().\n\n Parameters\n ----------\n node : Apply instance\n WRITEME\n name : str\n A name that is automa...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null }, { "param": "inputs", "type": null }, { "param": "outputs", "type": null }, { "param": "sub", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_support_code_apply
null
def c_support_code_apply(self, node, name): """ Optional: return utility code for use by an `Op` that will be inserted at global scope, that can be specialized for the support of a particular `Apply` node. Parameters ---------- node: an Apply instance in the grap...
Optional: return utility code for use by an `Op` that will be inserted at global scope, that can be specialized for the support of a particular `Apply` node. Parameters ---------- node: an Apply instance in the graph being compiled name: str A string...
return utility code for use by an `Op` that will be inserted at global scope, that can be specialized for the support of a particular `Apply` node. Parameters an Apply instance in the graph being compiled name: str A string or number that serves to uniquely identify this node. Symbol names defined by this support cod...
[ "return", "utility", "code", "for", "use", "by", "an", "`", "Op", "`", "that", "will", "be", "inserted", "at", "global", "scope", "that", "can", "be", "specialized", "for", "the", "support", "of", "a", "particular", "`", "Apply", "`", "node", ".", "Par...
def c_support_code_apply(self, node, name): raise utils.MethodNotDefined("c_support_code_apply", type(self), self.__class__.__name__)
[ "def", "c_support_code_apply", "(", "self", ",", "node", ",", "name", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_support_code_apply\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return utility code for use by an `Op` that will be inserted at global scope, that can be specialized for the support of a particular `Apply` node.
[ "Optional", ":", "return", "utility", "code", "for", "use", "by", "an", "`", "Op", "`", "that", "will", "be", "inserted", "at", "global", "scope", "that", "can", "be", "specialized", "for", "the", "support", "of", "a", "particular", "`", "Apply", "`", ...
[ "\"\"\"\n Optional: return utility code for use by an `Op` that will be\n inserted at global scope, that can be specialized for the\n support of a particular `Apply` node.\n\n Parameters\n ----------\n node: an Apply instance in the graph being compiled\n name: str\n...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_init_code_struct
null
def c_init_code_struct(self, node, name, sub): """ Optional: return a code string specific to the apply to be inserted in the struct initialization code. Parameters ---------- node : an Apply instance in the graph being compiled name : str A unique na...
Optional: return a code string specific to the apply to be inserted in the struct initialization code. Parameters ---------- node : an Apply instance in the graph being compiled name : str A unique name to distinguish variables from those of other nodes. ...
return a code string specific to the apply to be inserted in the struct initialization code. Parameters node : an Apply instance in the graph being compiled name : str A unique name to distinguish variables from those of other nodes. sub A dictionary of values to substitute in the code. Most notably it contains a 'fa...
[ "return", "a", "code", "string", "specific", "to", "the", "apply", "to", "be", "inserted", "in", "the", "struct", "initialization", "code", ".", "Parameters", "node", ":", "an", "Apply", "instance", "in", "the", "graph", "being", "compiled", "name", ":", "...
def c_init_code_struct(self, node, name, sub): raise utils.MethodNotDefined("c_init_code_struct", type(self), self.__class__.__name__)
[ "def", "c_init_code_struct", "(", "self", ",", "node", ",", "name", ",", "sub", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_init_code_struct\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return a code string specific to the apply to be inserted in the struct initialization code.
[ "Optional", ":", "return", "a", "code", "string", "specific", "to", "the", "apply", "to", "be", "inserted", "in", "the", "struct", "initialization", "code", "." ]
[ "\"\"\"\n Optional: return a code string specific to the apply\n to be inserted in the struct initialization code.\n\n Parameters\n ----------\n node : an Apply instance in the graph being compiled\n name : str\n A unique name to distinguish variables from those ...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null }, { "param": "sub", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_support_code_struct
null
def c_support_code_struct(self, node, name): """ Optional: return utility code for use by an `Op` that will be inserted at struct scope, that can be specialized for the support of a particular `Apply` node. Parameters ---------- node : an Apply instance in the gr...
Optional: return utility code for use by an `Op` that will be inserted at struct scope, that can be specialized for the support of a particular `Apply` node. Parameters ---------- node : an Apply instance in the graph being compiled name : str A uniq...
return utility code for use by an `Op` that will be inserted at struct scope, that can be specialized for the support of a particular `Apply` node. Parameters node : an Apply instance in the graph being compiled name : str A unique name to distinguish you variables from those of other nodes. Raises MethodNotDefined...
[ "return", "utility", "code", "for", "use", "by", "an", "`", "Op", "`", "that", "will", "be", "inserted", "at", "struct", "scope", "that", "can", "be", "specialized", "for", "the", "support", "of", "a", "particular", "`", "Apply", "`", "node", ".", "Par...
def c_support_code_struct(self, node, name): raise utils.MethodNotDefined("c_support_code_struct", type(self), self.__class__.__name__)
[ "def", "c_support_code_struct", "(", "self", ",", "node", ",", "name", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_support_code_struct\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return utility code for use by an `Op` that will be inserted at struct scope, that can be specialized for the support of a particular `Apply` node.
[ "Optional", ":", "return", "utility", "code", "for", "use", "by", "an", "`", "Op", "`", "that", "will", "be", "inserted", "at", "struct", "scope", "that", "can", "be", "specialized", "for", "the", "support", "of", "a", "particular", "`", "Apply", "`", ...
[ "\"\"\"\n Optional: return utility code for use by an `Op` that will be\n inserted at struct scope, that can be specialized for the\n support of a particular `Apply` node.\n\n Parameters\n ----------\n node : an Apply instance in the graph being compiled\n name : str...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_cleanup_code_struct
null
def c_cleanup_code_struct(self, node, name): """ Optional: return a code string specific to the apply to be inserted in the struct cleanup code. Parameters ---------- node : an Apply instance in the graph being compiled name : str A unique name to dis...
Optional: return a code string specific to the apply to be inserted in the struct cleanup code. Parameters ---------- node : an Apply instance in the graph being compiled name : str A unique name to distinguish variables from those of other nodes. R...
return a code string specific to the apply to be inserted in the struct cleanup code. Parameters node : an Apply instance in the graph being compiled name : str A unique name to distinguish variables from those of other nodes. Raises MethodNotDefined The subclass does not override this method.
[ "return", "a", "code", "string", "specific", "to", "the", "apply", "to", "be", "inserted", "in", "the", "struct", "cleanup", "code", ".", "Parameters", "node", ":", "an", "Apply", "instance", "in", "the", "graph", "being", "compiled", "name", ":", "str", ...
def c_cleanup_code_struct(self, node, name): raise utils.MethodNotDefined("c_cleanup_code_struct", type(self), self.__class__.__name__)
[ "def", "c_cleanup_code_struct", "(", "self", ",", "node", ",", "name", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"c_cleanup_code_struct\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Optional: return a code string specific to the apply to be inserted in the struct cleanup code.
[ "Optional", ":", "return", "a", "code", "string", "specific", "to", "the", "apply", "to", "be", "inserted", "in", "the", "struct", "cleanup", "code", "." ]
[ "\"\"\"\n Optional: return a code string specific to the apply to be\n inserted in the struct cleanup code.\n\n Parameters\n ----------\n node : an Apply instance in the graph being compiled\n name : str\n A unique name to distinguish variables from those of othe...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
make_node
null
def make_node(self, *inputs): """ Required: return an Apply instance representing the application of this Op to the provided inputs. """ raise utils.MethodNotDefined( "make_node", type(self), self.__class__.__name__)
Required: return an Apply instance representing the application of this Op to the provided inputs.
return an Apply instance representing the application of this Op to the provided inputs.
[ "return", "an", "Apply", "instance", "representing", "the", "application", "of", "this", "Op", "to", "the", "provided", "inputs", "." ]
def make_node(self, *inputs): raise utils.MethodNotDefined( "make_node", type(self), self.__class__.__name__)
[ "def", "make_node", "(", "self", ",", "*", "inputs", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"make_node\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "__name__", ")" ]
Required: return an Apply instance representing the application of this Op to the provided inputs.
[ "Required", ":", "return", "an", "Apply", "instance", "representing", "the", "application", "of", "this", "Op", "to", "the", "provided", "inputs", "." ]
[ "\"\"\"\n Required: return an Apply instance representing the\n application of this Op to the provided inputs.\n\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
perform
null
def perform(self, node, inputs, output_storage, params=None): """ Required: Calculate the function on the inputs and put the variables in the output storage. Return None. Parameters ---------- node : Apply instance Contains the symbolic inputs and outputs. ...
Required: Calculate the function on the inputs and put the variables in the output storage. Return None. Parameters ---------- node : Apply instance Contains the symbolic inputs and outputs. inputs : list Sequence of inputs (immutable). o...
Calculate the function on the inputs and put the variables in the output storage. Return None. Parameters node : Apply instance Contains the symbolic inputs and outputs. inputs : list Sequence of inputs (immutable). output_storage : list List of mutable 1-element lists (do not change the length of these lists) Notes...
[ "Calculate", "the", "function", "on", "the", "inputs", "and", "put", "the", "variables", "in", "the", "output", "storage", ".", "Return", "None", ".", "Parameters", "node", ":", "Apply", "instance", "Contains", "the", "symbolic", "inputs", "and", "outputs", ...
def perform(self, node, inputs, output_storage, params=None): raise utils.MethodNotDefined( "perform", type(self), self.__class__.__name__, "Did you used Theano flags mode=FAST_COMPILE?" " You can use optimizer=fast_compile instead.")
[ "def", "perform", "(", "self", ",", "node", ",", "inputs", ",", "output_storage", ",", "params", "=", "None", ")", ":", "raise", "utils", ".", "MethodNotDefined", "(", "\"perform\"", ",", "type", "(", "self", ")", ",", "self", ".", "__class__", ".", "_...
Required: Calculate the function on the inputs and put the variables in the output storage.
[ "Required", ":", "Calculate", "the", "function", "on", "the", "inputs", "and", "put", "the", "variables", "in", "the", "output", "storage", "." ]
[ "\"\"\"\n Required: Calculate the function on the inputs and put the variables in\n the output storage. Return None.\n\n Parameters\n ----------\n node : Apply instance\n Contains the symbolic inputs and outputs.\n inputs : list\n Sequence of inputs (i...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "inputs", "type": null }, { "param": "output_storage", "type": null }, { "param": "params", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
prepare_node
null
def prepare_node(self, node, storage_map, compute_map, impl): """ Make any special modifications that the Op needs before doing make_thunk(). This can modify the node inplace and should return nothing. It can be called multiple time with different impl. It is the op res...
Make any special modifications that the Op needs before doing make_thunk(). This can modify the node inplace and should return nothing. It can be called multiple time with different impl. It is the op responsibility to don't re-prepare the node when it isn't good to do...
Make any special modifications that the Op needs before doing make_thunk(). This can modify the node inplace and should return nothing. It can be called multiple time with different impl. It is the op responsibility to don't re-prepare the node when it isn't good to do so.
[ "Make", "any", "special", "modifications", "that", "the", "Op", "needs", "before", "doing", "make_thunk", "()", ".", "This", "can", "modify", "the", "node", "inplace", "and", "should", "return", "nothing", ".", "It", "can", "be", "called", "multiple", "time"...
def prepare_node(self, node, storage_map, compute_map, impl): pass
[ "def", "prepare_node", "(", "self", ",", "node", ",", "storage_map", ",", "compute_map", ",", "impl", ")", ":", "pass" ]
Make any special modifications that the Op needs before doing make_thunk().
[ "Make", "any", "special", "modifications", "that", "the", "Op", "needs", "before", "doing", "make_thunk", "()", "." ]
[ "\"\"\"\n Make any special modifications that the Op needs before doing\n make_thunk().\n\n This can modify the node inplace and should return nothing.\n\n It can be called multiple time with different impl. It is the\n op responsibility to don't re-prepare the node when it isn't\...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "storage_map", "type": null }, { "param": "compute_map", "type": null }, { "param": "impl", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
make_c_thunk
<not_specific>
def make_c_thunk(self, node, storage_map, compute_map, no_recycling): """Like make_thunk, but will only try to make a C thunk. """ node_input_storage = [storage_map[r] for r in node.inputs] node_output_storage = [storage_map[r] for r in node.outputs] e = FunctionGraph(node.inpu...
Like make_thunk, but will only try to make a C thunk.
Like make_thunk, but will only try to make a C thunk.
[ "Like", "make_thunk", "but", "will", "only", "try", "to", "make", "a", "C", "thunk", "." ]
def make_c_thunk(self, node, storage_map, compute_map, no_recycling): node_input_storage = [storage_map[r] for r in node.inputs] node_output_storage = [storage_map[r] for r in node.outputs] e = FunctionGraph(node.inputs, node.outputs) e_no_recycling = [new_o for...
[ "def", "make_c_thunk", "(", "self", ",", "node", ",", "storage_map", ",", "compute_map", ",", "no_recycling", ")", ":", "node_input_storage", "=", "[", "storage_map", "[", "r", "]", "for", "r", "in", "node", ".", "inputs", "]", "node_output_storage", "=", ...
Like make_thunk, but will only try to make a C thunk.
[ "Like", "make_thunk", "but", "will", "only", "try", "to", "make", "a", "C", "thunk", "." ]
[ "\"\"\"Like make_thunk, but will only try to make a C thunk.\n\n \"\"\"", "# float16 gets special treatment since running", "# unprepared C code will get bad results.", "# get_dynamic_module is a subset of make_thunk that is reused.", "# This just try to build the c code", "# It will raise an error...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "storage_map", "type": null }, { "param": "compute_map", "type": null }, { "param": "no_recycling", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
make_py_thunk
<not_specific>
def make_py_thunk(self, node, storage_map, compute_map, no_recycling, debug=False): """ Like make_thunk() but only makes python thunks. """ node_input_storage = [storage_map[r] for r in node.inputs] node_output_storage = [storage_map[r] for r in node.output...
Like make_thunk() but only makes python thunks.
Like make_thunk() but only makes python thunks.
[ "Like", "make_thunk", "()", "but", "only", "makes", "python", "thunks", "." ]
def make_py_thunk(self, node, storage_map, compute_map, no_recycling, debug=False): node_input_storage = [storage_map[r] for r in node.inputs] node_output_storage = [storage_map[r] for r in node.outputs] if debug: p = node.op.debug_perform else: ...
[ "def", "make_py_thunk", "(", "self", ",", "node", ",", "storage_map", ",", "compute_map", ",", "no_recycling", ",", "debug", "=", "False", ")", ":", "node_input_storage", "=", "[", "storage_map", "[", "r", "]", "for", "r", "in", "node", ".", "inputs", "]...
Like make_thunk() but only makes python thunks.
[ "Like", "make_thunk", "()", "but", "only", "makes", "python", "thunks", "." ]
[ "\"\"\"\n Like make_thunk() but only makes python thunks.\n\n \"\"\"", "# default arguments are stored in the closure of `rval`" ]
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "storage_map", "type": null }, { "param": "compute_map", "type": null }, { "param": "no_recycling", "type": null }, { "param": "debug", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
make_thunk
<not_specific>
def make_thunk(self, node, storage_map, compute_map, no_recycling, impl=None): """ This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node. Parameters ...
This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node. Parameters ---------- node Something previously returned by self.make_node. storage_map ...
This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node. Parameters node Something previously returned by self.make_node. storage_map dict variable -> one-element-list where a computed value for this variable may be...
[ "This", "function", "must", "return", "a", "thunk", "that", "is", "a", "zero", "-", "arguments", "function", "that", "encapsulates", "the", "computation", "to", "be", "performed", "by", "this", "op", "on", "the", "arguments", "of", "the", "node", ".", "Par...
def make_thunk(self, node, storage_map, compute_map, no_recycling, impl=None): if (impl is None and theano.config.cxx) or impl == 'c': self.prepare_node(node, storage_map=storage_map, compute_map=compute_map, impl='c') try: ...
[ "def", "make_thunk", "(", "self", ",", "node", ",", "storage_map", ",", "compute_map", ",", "no_recycling", ",", "impl", "=", "None", ")", ":", "if", "(", "impl", "is", "None", "and", "theano", ".", "config", ".", "cxx", ")", "or", "impl", "==", "'c'...
This function must return a thunk, that is a zero-arguments function that encapsulates the computation to be performed by this op on the arguments of the node.
[ "This", "function", "must", "return", "a", "thunk", "that", "is", "a", "zero", "-", "arguments", "function", "that", "encapsulates", "the", "computation", "to", "be", "performed", "by", "this", "op", "on", "the", "arguments", "of", "the", "node", "." ]
[ "\"\"\"\n This function must return a thunk, that is a zero-arguments\n function that encapsulates the computation to be performed\n by this op on the arguments of the node.\n\n Parameters\n ----------\n node\n Something previously returned by self.make_node.\n ...
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "storage_map", "type": null }, { "param": "compute_map", "type": null }, { "param": "no_recycling", "type": null }, { "param": "impl", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
make_node
<not_specific>
def make_node(self, *inputs): """ Create a "apply" nodes for the inputs in that order. """ if not hasattr(self, 'itypes'): raise NotImplementedError("You can either define itypes and otypes,\ or implement make_node") if not hasattr(self, 'otypes'): ...
Create a "apply" nodes for the inputs in that order.
Create a "apply" nodes for the inputs in that order.
[ "Create", "a", "\"", "apply", "\"", "nodes", "for", "the", "inputs", "in", "that", "order", "." ]
def make_node(self, *inputs): if not hasattr(self, 'itypes'): raise NotImplementedError("You can either define itypes and otypes,\ or implement make_node") if not hasattr(self, 'otypes'): raise NotImplementedError("You can either define itypes and otypes,\ ...
[ "def", "make_node", "(", "self", ",", "*", "inputs", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'itypes'", ")", ":", "raise", "NotImplementedError", "(", "\"You can either define itypes and otypes,\\\n or implement make_node\"", ")", "if", "not",...
Create a "apply" nodes for the inputs in that order.
[ "Create", "a", "\"", "apply", "\"", "nodes", "for", "the", "inputs", "in", "that", "order", "." ]
[ "\"\"\"\n Create a \"apply\" nodes for the inputs in that order.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
debug_assert
null
def debug_assert(condition, msg=None): """ Customized assert with options to ignore the assert with just a warning """ if msg is None: msg = 'debug_assert failed' if not condition: action = config.compute_test_value if action in ['raise', 'ignore']: raise Asse...
Customized assert with options to ignore the assert with just a warning
Customized assert with options to ignore the assert with just a warning
[ "Customized", "assert", "with", "options", "to", "ignore", "the", "assert", "with", "just", "a", "warning" ]
def debug_assert(condition, msg=None): if msg is None: msg = 'debug_assert failed' if not condition: action = config.compute_test_value if action in ['raise', 'ignore']: raise AssertionError(msg) else: assert action == 'warn' warnings.warn(msg,...
[ "def", "debug_assert", "(", "condition", ",", "msg", "=", "None", ")", ":", "if", "msg", "is", "None", ":", "msg", "=", "'debug_assert failed'", "if", "not", "condition", ":", "action", "=", "config", ".", "compute_test_value", "if", "action", "in", "[", ...
Customized assert with options to ignore the assert with just a warning
[ "Customized", "assert", "with", "options", "to", "ignore", "the", "assert", "with", "just", "a", "warning" ]
[ "\"\"\"\n Customized assert with options to ignore the assert\n with just a warning\n \"\"\"" ]
[ { "param": "condition", "type": null }, { "param": "msg", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "condition", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "msg", "type": null, "docstring": null, "docstring_tokens...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_compile_args
<not_specific>
def c_compile_args(self): """ Return the compilation arg "fopenmp" if openMP is supported """ self.update_self_openmp() if self.openmp: return ['-fopenmp'] return []
Return the compilation arg "fopenmp" if openMP is supported
Return the compilation arg "fopenmp" if openMP is supported
[ "Return", "the", "compilation", "arg", "\"", "fopenmp", "\"", "if", "openMP", "is", "supported" ]
def c_compile_args(self): self.update_self_openmp() if self.openmp: return ['-fopenmp'] return []
[ "def", "c_compile_args", "(", "self", ")", ":", "self", ".", "update_self_openmp", "(", ")", "if", "self", ".", "openmp", ":", "return", "[", "'-fopenmp'", "]", "return", "[", "]" ]
Return the compilation arg "fopenmp" if openMP is supported
[ "Return", "the", "compilation", "arg", "\"", "fopenmp", "\"", "if", "openMP", "is", "supported" ]
[ "\"\"\"\n Return the compilation arg \"fopenmp\" if openMP is supported\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_headers
<not_specific>
def c_headers(self): """ Return the header file name "omp.h" if openMP is supported """ self.update_self_openmp() if self.openmp: return ["omp.h"] return []
Return the header file name "omp.h" if openMP is supported
Return the header file name "omp.h" if openMP is supported
[ "Return", "the", "header", "file", "name", "\"", "omp", ".", "h", "\"", "if", "openMP", "is", "supported" ]
def c_headers(self): self.update_self_openmp() if self.openmp: return ["omp.h"] return []
[ "def", "c_headers", "(", "self", ")", ":", "self", ".", "update_self_openmp", "(", ")", "if", "self", ".", "openmp", ":", "return", "[", "\"omp.h\"", "]", "return", "[", "]" ]
Return the header file name "omp.h" if openMP is supported
[ "Return", "the", "header", "file", "name", "\"", "omp", ".", "h", "\"", "if", "openMP", "is", "supported" ]
[ "\"\"\"\n Return the header file name \"omp.h\" if openMP is supported\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
load_c_code
null
def load_c_code(self, func_files): """ Loads the c code to perform the Op """ func_files = [self.get_path(f) for f in func_files] self.func_codes = [] for func_file in func_files: # U (universal) will convert all new lines format to \n. with _open_...
Loads the c code to perform the Op
Loads the c code to perform the Op
[ "Loads", "the", "c", "code", "to", "perform", "the", "Op" ]
def load_c_code(self, func_files): func_files = [self.get_path(f) for f in func_files] self.func_codes = [] for func_file in func_files: with _open_u(func_file) as f: self.func_codes.append(f.read()) old_markers_present = False new_markers_present = Fa...
[ "def", "load_c_code", "(", "self", ",", "func_files", ")", ":", "func_files", "=", "[", "self", ".", "get_path", "(", "f", ")", "for", "f", "in", "func_files", "]", "self", ".", "func_codes", "=", "[", "]", "for", "func_file", "in", "func_files", ":", ...
Loads the c code to perform the Op
[ "Loads", "the", "c", "code", "to", "perform", "the", "Op" ]
[ "\"\"\"\n Loads the c code to perform the Op\n \"\"\"", "# U (universal) will convert all new lines format to \\n.", "# If both the old section markers and the new section markers are", "# present, raise an error because we don't know which ones to follow.", "# This is backward compat code tha...
[ { "param": "self", "type": null }, { "param": "func_files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "func_files", "type": null, "docstring": null, "docstring_toke...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
__get_op_params
<not_specific>
def __get_op_params(self): """ Returns a list of (name, value) pairs that will be turned into macros for use within the op code. The names must be strings that are not a C keyword and the values must be strings of literal C representations. If op uses a :class:`theano.g...
Returns a list of (name, value) pairs that will be turned into macros for use within the op code. The names must be strings that are not a C keyword and the values must be strings of literal C representations. If op uses a :class:`theano.gof.params_type.ParamsType` as ``params...
Returns a list of (name, value) pairs that will be turned into macros for use within the op code. The names must be strings that are not a C keyword and the values must be strings of literal C representations.
[ "Returns", "a", "list", "of", "(", "name", "value", ")", "pairs", "that", "will", "be", "turned", "into", "macros", "for", "use", "within", "the", "op", "code", ".", "The", "names", "must", "be", "strings", "that", "are", "not", "a", "C", "keyword", ...
def __get_op_params(self): if hasattr(self, 'params_type') and isinstance(self.params_type, theano.gof.ParamsType): wrapper = self.params_type params = [('PARAMS_TYPE', wrapper.name)] for i in range(wrapper.length): try: params.append(('DTY...
[ "def", "__get_op_params", "(", "self", ")", ":", "if", "hasattr", "(", "self", ",", "'params_type'", ")", "and", "isinstance", "(", "self", ".", "params_type", ",", "theano", ".", "gof", ".", "ParamsType", ")", ":", "wrapper", "=", "self", ".", "params_t...
Returns a list of (name, value) pairs that will be turned into macros for use within the op code.
[ "Returns", "a", "list", "of", "(", "name", "value", ")", "pairs", "that", "will", "be", "turned", "into", "macros", "for", "use", "within", "the", "op", "code", "." ]
[ "\"\"\"\n Returns a list of (name, value) pairs that will be turned into\n macros for use within the op code.\n\n The names must be strings that are not a C keyword and the\n values must be strings of literal C representations.\n\n If op uses a :class:`theano.gof.params_type.Param...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_init_code
<not_specific>
def c_init_code(self): """ Get the code section for init_code """ if 'init_code' in self.code_sections: return [self.code_sections['init_code']] else: raise utils.MethodNotDefined( 'c_init_code', type(self), type(self).__name__)
Get the code section for init_code
Get the code section for init_code
[ "Get", "the", "code", "section", "for", "init_code" ]
def c_init_code(self): if 'init_code' in self.code_sections: return [self.code_sections['init_code']] else: raise utils.MethodNotDefined( 'c_init_code', type(self), type(self).__name__)
[ "def", "c_init_code", "(", "self", ")", ":", "if", "'init_code'", "in", "self", ".", "code_sections", ":", "return", "[", "self", ".", "code_sections", "[", "'init_code'", "]", "]", "else", ":", "raise", "utils", ".", "MethodNotDefined", "(", "'c_init_code'"...
Get the code section for init_code
[ "Get", "the", "code", "section", "for", "init_code" ]
[ "\"\"\"\n Get the code section for init_code\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_init_code_struct
<not_specific>
def c_init_code_struct(self, node, name, sub): """ Stitches all the macros and "init_code" together """ if 'init_code_struct' in self.code_sections: op_code = self.code_sections['init_code_struct'] def_macros, undef_macros = self.get_c_macros(node, name) ...
Stitches all the macros and "init_code" together
Stitches all the macros and "init_code" together
[ "Stitches", "all", "the", "macros", "and", "\"", "init_code", "\"", "together" ]
def c_init_code_struct(self, node, name, sub): if 'init_code_struct' in self.code_sections: op_code = self.code_sections['init_code_struct'] def_macros, undef_macros = self.get_c_macros(node, name) def_sub, undef_sub = self.get_sub_macros(sub) return '\n'.join([''...
[ "def", "c_init_code_struct", "(", "self", ",", "node", ",", "name", ",", "sub", ")", ":", "if", "'init_code_struct'", "in", "self", ".", "code_sections", ":", "op_code", "=", "self", ".", "code_sections", "[", "'init_code_struct'", "]", "def_macros", ",", "u...
Stitches all the macros and "init_code" together
[ "Stitches", "all", "the", "macros", "and", "\"", "init_code", "\"", "together" ]
[ "\"\"\"\n Stitches all the macros and \"init_code\" together\n\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null }, { "param": "sub", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
cbaf4ef5388965d07077ec06b7806a17d5ecb15d
AIPYX/theano
theano/gof/op.py
[ "BSD-3-Clause" ]
Python
c_code_cleanup
<not_specific>
def c_code_cleanup(self, node, name, inputs, outputs, sub): """ Stitches all the macros and "code_cleanup" together """ if 'code_cleanup' in self.code_sections: op_code = self.code_sections['code_cleanup'] def_macros, undef_macros = self.get_c_macros(node, name) ...
Stitches all the macros and "code_cleanup" together
Stitches all the macros and "code_cleanup" together
[ "Stitches", "all", "the", "macros", "and", "\"", "code_cleanup", "\"", "together" ]
def c_code_cleanup(self, node, name, inputs, outputs, sub): if 'code_cleanup' in self.code_sections: op_code = self.code_sections['code_cleanup'] def_macros, undef_macros = self.get_c_macros(node, name) def_sub, undef_sub = self.get_sub_macros(sub) def_io, undef_i...
[ "def", "c_code_cleanup", "(", "self", ",", "node", ",", "name", ",", "inputs", ",", "outputs", ",", "sub", ")", ":", "if", "'code_cleanup'", "in", "self", ".", "code_sections", ":", "op_code", "=", "self", ".", "code_sections", "[", "'code_cleanup'", "]", ...
Stitches all the macros and "code_cleanup" together
[ "Stitches", "all", "the", "macros", "and", "\"", "code_cleanup", "\"", "together" ]
[ "\"\"\"\n Stitches all the macros and \"code_cleanup\" together\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "node", "type": null }, { "param": "name", "type": null }, { "param": "inputs", "type": null }, { "param": "outputs", "type": null }, { "param": "sub", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "node", "type": null, "docstring": null, "docstring_tokens": [...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
module_name_from_dir
<not_specific>
def module_name_from_dir(dirname, err=True, files=None): """ Scan the contents of a cache directory and return full path of the dynamic lib in it. """ if files is None: try: files = os.listdir(dirname) except OSError as e: if e.errno == 2 and not err: # No s...
Scan the contents of a cache directory and return full path of the dynamic lib in it.
Scan the contents of a cache directory and return full path of the dynamic lib in it.
[ "Scan", "the", "contents", "of", "a", "cache", "directory", "and", "return", "full", "path", "of", "the", "dynamic", "lib", "in", "it", "." ]
def module_name_from_dir(dirname, err=True, files=None): if files is None: try: files = os.listdir(dirname) except OSError as e: if e.errno == 2 and not err: return None names = [file for file in files if file.endswith('.so') or file.endswit...
[ "def", "module_name_from_dir", "(", "dirname", ",", "err", "=", "True", ",", "files", "=", "None", ")", ":", "if", "files", "is", "None", ":", "try", ":", "files", "=", "os", ".", "listdir", "(", "dirname", ")", "except", "OSError", "as", "e", ":", ...
Scan the contents of a cache directory and return full path of the dynamic lib in it.
[ "Scan", "the", "contents", "of", "a", "cache", "directory", "and", "return", "full", "path", "of", "the", "dynamic", "lib", "in", "it", "." ]
[ "\"\"\"\n Scan the contents of a cache directory and return full path of the\n dynamic lib in it.\n\n \"\"\"", "# No such file or directory" ]
[ { "param": "dirname", "type": null }, { "param": "err", "type": null }, { "param": "files", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dirname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "err", "type": null, "docstring": null, "docstring_tokens":...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
delete_keys_from
null
def delete_keys_from(self, entry_from_key, do_manual_check=True): """ Delete from entry_from_key all keys associated to this KeyData object. Note that broken keys will not appear in the keys field, so we also manually look for keys associated to the same entry, unless do_manual_...
Delete from entry_from_key all keys associated to this KeyData object. Note that broken keys will not appear in the keys field, so we also manually look for keys associated to the same entry, unless do_manual_check is False.
Delete from entry_from_key all keys associated to this KeyData object. Note that broken keys will not appear in the keys field, so we also manually look for keys associated to the same entry, unless do_manual_check is False.
[ "Delete", "from", "entry_from_key", "all", "keys", "associated", "to", "this", "KeyData", "object", ".", "Note", "that", "broken", "keys", "will", "not", "appear", "in", "the", "keys", "field", "so", "we", "also", "manually", "look", "for", "keys", "associat...
def delete_keys_from(self, entry_from_key, do_manual_check=True): entry = self.get_entry() for key in self.keys: try: del entry_from_key[key] except KeyError: pass if do_manual_check: to_del = [] for key, key_entry i...
[ "def", "delete_keys_from", "(", "self", ",", "entry_from_key", ",", "do_manual_check", "=", "True", ")", ":", "entry", "=", "self", ".", "get_entry", "(", ")", "for", "key", "in", "self", ".", "keys", ":", "try", ":", "del", "entry_from_key", "[", "key",...
Delete from entry_from_key all keys associated to this KeyData object.
[ "Delete", "from", "entry_from_key", "all", "keys", "associated", "to", "this", "KeyData", "object", "." ]
[ "\"\"\"\n Delete from entry_from_key all keys associated to this KeyData object.\n\n Note that broken keys will not appear in the keys field, so we also\n manually look for keys associated to the same entry, unless\n do_manual_check is False.\n\n \"\"\"", "# This happen if the c...
[ { "param": "self", "type": null }, { "param": "entry_from_key", "type": null }, { "param": "do_manual_check", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entry_from_key", "type": null, "docstring": null, "docstring_...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
refresh
<not_specific>
def refresh(self, age_thresh_use=None, delete_if_problem=False, cleanup=True): """ Update cache data by walking the cache directory structure. Load key.pkl files that have not been loaded yet. Remove entries which have been removed from the filesystem. Also, remo...
Update cache data by walking the cache directory structure. Load key.pkl files that have not been loaded yet. Remove entries which have been removed from the filesystem. Also, remove malformed cache directories. Parameters ---------- age_thresh_use ...
Update cache data by walking the cache directory structure. Load key.pkl files that have not been loaded yet. Remove entries which have been removed from the filesystem. Also, remove malformed cache directories. Parameters age_thresh_use Do not use modules other than this. Returns list A list of modules of age high...
[ "Update", "cache", "data", "by", "walking", "the", "cache", "directory", "structure", ".", "Load", "key", ".", "pkl", "files", "that", "have", "not", "been", "loaded", "yet", ".", "Remove", "entries", "which", "have", "been", "removed", "from", "the", "fil...
def refresh(self, age_thresh_use=None, delete_if_problem=False, cleanup=True): if age_thresh_use is None: age_thresh_use = self.age_thresh_use start_time = time.time() too_old_to_use = [] to_delete = [] to_delete_empty = [] def rmtree(*args, **...
[ "def", "refresh", "(", "self", ",", "age_thresh_use", "=", "None", ",", "delete_if_problem", "=", "False", ",", "cleanup", "=", "True", ")", ":", "if", "age_thresh_use", "is", "None", ":", "age_thresh_use", "=", "self", ".", "age_thresh_use", "start_time", "...
Update cache data by walking the cache directory structure.
[ "Update", "cache", "data", "by", "walking", "the", "cache", "directory", "structure", "." ]
[ "\"\"\"\n Update cache data by walking the cache directory structure.\n\n Load key.pkl files that have not been loaded yet.\n Remove entries which have been removed from the filesystem.\n Also, remove malformed cache directories.\n\n Parameters\n ----------\n age_thr...
[ { "param": "self", "type": null }, { "param": "age_thresh_use", "type": null }, { "param": "delete_if_problem", "type": null }, { "param": "cleanup", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "age_thresh_use", "type": null, "docstring": null, "docstring_...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
clear_base_files
null
def clear_base_files(self): """ Remove base directories 'cutils_ext', 'lazylinker_ext' and 'scan_perform' if present. Note that we do not delete them outright because it may not work on some systems due to these modules being currently in use. Instead we rename them with...
Remove base directories 'cutils_ext', 'lazylinker_ext' and 'scan_perform' if present. Note that we do not delete them outright because it may not work on some systems due to these modules being currently in use. Instead we rename them with the '.delete.me' extension, to mark th...
Note that we do not delete them outright because it may not work on some systems due to these modules being currently in use. Instead we rename them with the '.delete.me' extension, to mark them to be deleted next time we clear the cache.
[ "Note", "that", "we", "do", "not", "delete", "them", "outright", "because", "it", "may", "not", "work", "on", "some", "systems", "due", "to", "these", "modules", "being", "currently", "in", "use", ".", "Instead", "we", "rename", "them", "with", "the", "'...
def clear_base_files(self): with compilelock.lock_ctx(): for base_dir in ('cutils_ext', 'lazylinker_ext', 'scan_perform'): to_delete = os.path.join(self.dirname, base_dir + '.delete.me') if os.path.isdir(to_delete): try: shu...
[ "def", "clear_base_files", "(", "self", ")", ":", "with", "compilelock", ".", "lock_ctx", "(", ")", ":", "for", "base_dir", "in", "(", "'cutils_ext'", ",", "'lazylinker_ext'", ",", "'scan_perform'", ")", ":", "to_delete", "=", "os", ".", "path", ".", "join...
Remove base directories 'cutils_ext', 'lazylinker_ext' and 'scan_perform' if present.
[ "Remove", "base", "directories", "'", "cutils_ext", "'", "'", "lazylinker_ext", "'", "and", "'", "scan_perform", "'", "if", "present", "." ]
[ "\"\"\"\n Remove base directories 'cutils_ext', 'lazylinker_ext' and\n 'scan_perform' if present.\n\n Note that we do not delete them outright because it may not work on\n some systems due to these modules being currently in use. Instead we\n rename them with the '.delete.me' exte...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
clear_unversioned
null
def clear_unversioned(self, min_age=None): """Delete unversioned dynamic modules. They are deleted both from the internal dictionaries and from the filesystem. No need to have the lock when calling this method. It does not take the lock as unversioned module aren't shared. ...
Delete unversioned dynamic modules. They are deleted both from the internal dictionaries and from the filesystem. No need to have the lock when calling this method. It does not take the lock as unversioned module aren't shared. This method does not refresh the cache content, i...
Delete unversioned dynamic modules. They are deleted both from the internal dictionaries and from the filesystem. No need to have the lock when calling this method. It does not take the lock as unversioned module aren't shared. This method does not refresh the cache content, it just accesses the in-memory known modul...
[ "Delete", "unversioned", "dynamic", "modules", ".", "They", "are", "deleted", "both", "from", "the", "internal", "dictionaries", "and", "from", "the", "filesystem", ".", "No", "need", "to", "have", "the", "lock", "when", "calling", "this", "method", ".", "It...
def clear_unversioned(self, min_age=None): if min_age is None: min_age = self.age_thresh_del_unversioned all_key_datas = list(self.module_hash_to_key_data.values()) for key_data in all_key_datas: if not key_data.keys: continue for key_idx, key ...
[ "def", "clear_unversioned", "(", "self", ",", "min_age", "=", "None", ")", ":", "if", "min_age", "is", "None", ":", "min_age", "=", "self", ".", "age_thresh_del_unversioned", "all_key_datas", "=", "list", "(", "self", ".", "module_hash_to_key_data", ".", "valu...
Delete unversioned dynamic modules.
[ "Delete", "unversioned", "dynamic", "modules", "." ]
[ "\"\"\"Delete unversioned dynamic modules.\n\n They are deleted both from the internal dictionaries and from the\n filesystem.\n\n No need to have the lock when calling this method. It does not\n take the lock as unversioned module aren't shared.\n\n This method does not refresh t...
[ { "param": "self", "type": null }, { "param": "min_age", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "min_age", "type": null, "docstring": null, "docstring_tokens"...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
_rmtree
<not_specific>
def _rmtree(parent, ignore_nocleanup=False, msg='', level=logging.DEBUG, ignore_if_missing=False): """ On NFS filesystems, it is impossible to delete a directory with open files in it. So instead, some commands in this file will respond to a failed rmtree() by touching a 'delete.me' fil...
On NFS filesystems, it is impossible to delete a directory with open files in it. So instead, some commands in this file will respond to a failed rmtree() by touching a 'delete.me' file. This file is a message for a future process to try deleting the directory. Parameters: ---------- ...
On NFS filesystems, it is impossible to delete a directory with open files in it. So instead, some commands in this file will respond to a failed rmtree() by touching a 'delete.me' file. This file is a message for a future process to try deleting the directory. parent Root node to start deleting from ignore_noclea...
[ "On", "NFS", "filesystems", "it", "is", "impossible", "to", "delete", "a", "directory", "with", "open", "files", "in", "it", ".", "So", "instead", "some", "commands", "in", "this", "file", "will", "respond", "to", "a", "failed", "rmtree", "()", "by", "to...
def _rmtree(parent, ignore_nocleanup=False, msg='', level=logging.DEBUG, ignore_if_missing=False): if ignore_if_missing and not os.path.exists(parent): return try: if ignore_nocleanup or not config.nocleanup: log_msg = 'Deleting' if msg: log_ms...
[ "def", "_rmtree", "(", "parent", ",", "ignore_nocleanup", "=", "False", ",", "msg", "=", "''", ",", "level", "=", "logging", ".", "DEBUG", ",", "ignore_if_missing", "=", "False", ")", ":", "if", "ignore_if_missing", "and", "not", "os", ".", "path", ".", ...
On NFS filesystems, it is impossible to delete a directory with open files in it.
[ "On", "NFS", "filesystems", "it", "is", "impossible", "to", "delete", "a", "directory", "with", "open", "files", "in", "it", "." ]
[ "\"\"\"\n On NFS filesystems, it is impossible to delete a directory with open\n files in it.\n\n So instead, some commands in this file will respond to a\n failed rmtree() by touching a 'delete.me' file. This file is a message\n for a future process to try deleting the directory.\n\n Parameters:...
[ { "param": "parent", "type": null }, { "param": "ignore_nocleanup", "type": null }, { "param": "msg", "type": null }, { "param": "level", "type": null }, { "param": "ignore_if_missing", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "parent", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ignore_nocleanup", "type": null, "docstring": null, "docstr...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
_try_compile_tmp
<not_specific>
def _try_compile_tmp(cls, src_code, tmp_prefix='', flags=(), try_run=False, output=False, compiler=None, comp_args=True): """ Try to compile (and run) a test program. This is useful in various occasions, to check if libraries or compiler...
Try to compile (and run) a test program. This is useful in various occasions, to check if libraries or compilers are behaving as expected. If try_run is True, the src_code is assumed to be executable, and will be run. If try_run is False, returns the compilation statu...
Try to compile (and run) a test program. This is useful in various occasions, to check if libraries or compilers are behaving as expected. If try_run is True, the src_code is assumed to be executable, and will be run. If try_run is False, returns the compilation status. Compile arguments from the Compiler's compile_...
[ "Try", "to", "compile", "(", "and", "run", ")", "a", "test", "program", ".", "This", "is", "useful", "in", "various", "occasions", "to", "check", "if", "libraries", "or", "compilers", "are", "behaving", "as", "expected", ".", "If", "try_run", "is", "True...
def _try_compile_tmp(cls, src_code, tmp_prefix='', flags=(), try_run=False, output=False, compiler=None, comp_args=True): if not compiler: return False flags = list(flags) if comp_args: args = cls.compile_args() el...
[ "def", "_try_compile_tmp", "(", "cls", ",", "src_code", ",", "tmp_prefix", "=", "''", ",", "flags", "=", "(", ")", ",", "try_run", "=", "False", ",", "output", "=", "False", ",", "compiler", "=", "None", ",", "comp_args", "=", "True", ")", ":", "if",...
Try to compile (and run) a test program.
[ "Try", "to", "compile", "(", "and", "run", ")", "a", "test", "program", "." ]
[ "\"\"\"\n Try to compile (and run) a test program.\n\n This is useful in various occasions, to check if libraries\n or compilers are behaving as expected.\n\n If try_run is True, the src_code is assumed to be executable,\n and will be run.\n\n If try_run is False, returns t...
[ { "param": "cls", "type": null }, { "param": "src_code", "type": null }, { "param": "tmp_prefix", "type": null }, { "param": "flags", "type": null }, { "param": "try_run", "type": null }, { "param": "output", "type": null }, { "param": "com...
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src_code", "type": null, "docstring": null, "docstring_tokens"...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
_try_flags
<not_specific>
def _try_flags(cls, flag_list, preambule="", body="", try_run=False, output=False, compiler=None, comp_args=True): """ Try to compile a dummy file with these flags. Returns True if compilation was successful, False if there were errors. Com...
Try to compile a dummy file with these flags. Returns True if compilation was successful, False if there were errors. Compile arguments from the Compiler's compile_args() method are added if comp_args=True.
Try to compile a dummy file with these flags. Returns True if compilation was successful, False if there were errors. Compile arguments from the Compiler's compile_args() method are added if comp_args=True.
[ "Try", "to", "compile", "a", "dummy", "file", "with", "these", "flags", ".", "Returns", "True", "if", "compilation", "was", "successful", "False", "if", "there", "were", "errors", ".", "Compile", "arguments", "from", "the", "Compiler", "'", "s", "compile_arg...
def _try_flags(cls, flag_list, preambule="", body="", try_run=False, output=False, compiler=None, comp_args=True): if not compiler: return False code = b(""" %(preambule)s int main(int argc, char** argv) { %(body)s ...
[ "def", "_try_flags", "(", "cls", ",", "flag_list", ",", "preambule", "=", "\"\"", ",", "body", "=", "\"\"", ",", "try_run", "=", "False", ",", "output", "=", "False", ",", "compiler", "=", "None", ",", "comp_args", "=", "True", ")", ":", "if", "not",...
Try to compile a dummy file with these flags.
[ "Try", "to", "compile", "a", "dummy", "file", "with", "these", "flags", "." ]
[ "\"\"\"\n Try to compile a dummy file with these flags.\n\n Returns True if compilation was successful, False if there\n were errors.\n\n Compile arguments from the Compiler's compile_args() method are added\n if comp_args=True.\n\n \"\"\"" ]
[ { "param": "cls", "type": null }, { "param": "flag_list", "type": null }, { "param": "preambule", "type": null }, { "param": "body", "type": null }, { "param": "try_run", "type": null }, { "param": "output", "type": null }, { "param": "comp...
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "flag_list", "type": null, "docstring": null, "docstring_tokens...
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
try_march_flag
<not_specific>
def try_march_flag(flags): """ Try to compile and run a simple C snippet using current flags. Return: compilation success (True/False), execution success (True/False) """ test_code = textwrap.dedent("""\ #include <cmath> using namespace std; int main(int a...
Try to compile and run a simple C snippet using current flags. Return: compilation success (True/False), execution success (True/False)
Try to compile and run a simple C snippet using current flags. Return: compilation success (True/False), execution success (True/False)
[ "Try", "to", "compile", "and", "run", "a", "simple", "C", "snippet", "using", "current", "flags", ".", "Return", ":", "compilation", "success", "(", "True", "/", "False", ")", "execution", "success", "(", "True", "/", "False", ")" ]
def try_march_flag(flags): test_code = textwrap.dedent("""\ #include <cmath> using namespace std; int main(int argc, char** argv) { float Nx = -1.3787706641; float Sx = 25.0; double r = Nx + sqrt(Sx); if ...
[ "def", "try_march_flag", "(", "flags", ")", ":", "test_code", "=", "textwrap", ".", "dedent", "(", "\"\"\"\\\n #include <cmath>\n using namespace std;\n int main(int argc, char** argv)\n {\n float Nx = -1.3787706641;\n ...
Try to compile and run a simple C snippet using current flags.
[ "Try", "to", "compile", "and", "run", "a", "simple", "C", "snippet", "using", "current", "flags", "." ]
[ "\"\"\"\n Try to compile and run a simple C snippet using current flags.\n Return: compilation success (True/False), execution success (True/False)\n \"\"\"" ]
[ { "param": "flags", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "flags", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
41aa3233bb58c160033c72e5dd4878407bd49830
AIPYX/theano
theano/gof/cmodule.py
[ "BSD-3-Clause" ]
Python
compile_str
<not_specific>
def compile_str(module_name, src_code, location=None, include_dirs=None, lib_dirs=None, libs=None, preargs=None, py_module=True, hide_symbols=True): """ Parameters ---------- module_name : str This has been embedded in the src_code. ...
Parameters ---------- module_name : str This has been embedded in the src_code. src_code A complete c or c++ source listing for the module. location A pre-existing filesystem directory where the cpp file and .so will be written. ...
Parameters module_name : str This has been embedded in the src_code. src_code A complete c or c++ source listing for the module. location A pre-existing filesystem directory where the cpp file and .so will be written. include_dirs A list of include directory names (each gets prefixed with -I). lib_dirs A list of librar...
[ "Parameters", "module_name", ":", "str", "This", "has", "been", "embedded", "in", "the", "src_code", ".", "src_code", "A", "complete", "c", "or", "c", "++", "source", "listing", "for", "the", "module", ".", "location", "A", "pre", "-", "existing", "filesys...
def compile_str(module_name, src_code, location=None, include_dirs=None, lib_dirs=None, libs=None, preargs=None, py_module=True, hide_symbols=True): if not theano.config.cxx: raise MissingGXX("g++ not available! We can't compile c code.") if include_di...
[ "def", "compile_str", "(", "module_name", ",", "src_code", ",", "location", "=", "None", ",", "include_dirs", "=", "None", ",", "lib_dirs", "=", "None", ",", "libs", "=", "None", ",", "preargs", "=", "None", ",", "py_module", "=", "True", ",", "hide_symb...
Parameters module_name : str This has been embedded in the src_code.
[ "Parameters", "module_name", ":", "str", "This", "has", "been", "embedded", "in", "the", "src_code", "." ]
[ "\"\"\"\n Parameters\n ----------\n module_name : str\n This has been embedded in the src_code.\n src_code\n A complete c or c++ source listing for the module.\n location\n A pre-existing filesystem directory where the cpp file and .so will\n ...
[ { "param": "module_name", "type": null }, { "param": "src_code", "type": null }, { "param": "location", "type": null }, { "param": "include_dirs", "type": null }, { "param": "lib_dirs", "type": null }, { "param": "libs", "type": null }, { "...
{ "returns": [], "raises": [], "params": [ { "identifier": "module_name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "src_code", "type": null, "docstring": null, "docstring...
6cea3cd7298d380e760fc91c02f1e9cd75d08469
AIPYX/theano
theano/gpuarray/opt.py
[ "BSD-3-Clause" ]
Python
split_inputs
<not_specific>
def split_inputs(inputs, max_nb_inputs, op): """ For some ops like add and mul, a large number of inputs can make nvcc fail compilation of our current code. We don't want node in the graph that can't execute as this break DebugMode. This should not happen for other GpuElemwise as their is only the ...
For some ops like add and mul, a large number of inputs can make nvcc fail compilation of our current code. We don't want node in the graph that can't execute as this break DebugMode. This should not happen for other GpuElemwise as their is only the fusion that can generate op with too much input ...
For some ops like add and mul, a large number of inputs can make nvcc fail compilation of our current code. We don't want node in the graph that can't execute as this break DebugMode. This should not happen for other GpuElemwise as their is only the fusion that can generate op with too much input and it check for that...
[ "For", "some", "ops", "like", "add", "and", "mul", "a", "large", "number", "of", "inputs", "can", "make", "nvcc", "fail", "compilation", "of", "our", "current", "code", ".", "We", "don", "'", "t", "want", "node", "in", "the", "graph", "that", "can", ...
def split_inputs(inputs, max_nb_inputs, op): if max_nb_inputs <= 1 and len(inputs) > 1: raise ValueError("Can not split nodes because inputs' dimensionality and/or" " number of outputs is too large") while len(inputs) > max_nb_inputs: inner_ops = [] for i in rang...
[ "def", "split_inputs", "(", "inputs", ",", "max_nb_inputs", ",", "op", ")", ":", "if", "max_nb_inputs", "<=", "1", "and", "len", "(", "inputs", ")", ">", "1", ":", "raise", "ValueError", "(", "\"Can not split nodes because inputs' dimensionality and/or\"", "\" num...
For some ops like add and mul, a large number of inputs can make nvcc fail compilation of our current code.
[ "For", "some", "ops", "like", "add", "and", "mul", "a", "large", "number", "of", "inputs", "can", "make", "nvcc", "fail", "compilation", "of", "our", "current", "code", "." ]
[ "\"\"\"\n For some ops like add and mul, a large number of inputs can make nvcc fail\n compilation of our current code. We don't want node in the graph that can't\n execute as this break DebugMode.\n\n This should not happen for other GpuElemwise as their is only the fusion\n that can generate op wit...
[ { "param": "inputs", "type": null }, { "param": "max_nb_inputs", "type": null }, { "param": "op", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputs", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "max_nb_inputs", "type": null, "docstring": null, "docstring...
45dffc18231d564c69db135bc18323c1cc1381e3
Colin-b/keepachangelog
keepachangelog/_versioning.py
[ "MIT" ]
Python
to_sorted_semantic
List[Tuple[str, dict]]
def to_sorted_semantic(versions: Iterable[str]) -> List[Tuple[str, dict]]: """ Convert a list of string semantic versions to a sorted list of semantic versions. Note: unreleased is not considered as a semantic version and will thus be removed from the resulting versions. :param versions: un-ordered lis...
Convert a list of string semantic versions to a sorted list of semantic versions. Note: unreleased is not considered as a semantic version and will thus be removed from the resulting versions. :param versions: un-ordered list of semantic versions (as string). Can contains unreleased. :return: An order...
Convert a list of string semantic versions to a sorted list of semantic versions. Note: unreleased is not considered as a semantic version and will thus be removed from the resulting versions.
[ "Convert", "a", "list", "of", "string", "semantic", "versions", "to", "a", "sorted", "list", "of", "semantic", "versions", ".", "Note", ":", "unreleased", "is", "not", "considered", "as", "a", "semantic", "version", "and", "will", "thus", "be", "removed", ...
def to_sorted_semantic(versions: Iterable[str]) -> List[Tuple[str, dict]]: return sorted( [ (version, to_semantic(version)) for version in versions if version != "unreleased" ], key=cmp_to_key(semantic_order), )
[ "def", "to_sorted_semantic", "(", "versions", ":", "Iterable", "[", "str", "]", ")", "->", "List", "[", "Tuple", "[", "str", ",", "dict", "]", "]", ":", "return", "sorted", "(", "[", "(", "version", ",", "to_semantic", "(", "version", ")", ")", "for"...
Convert a list of string semantic versions to a sorted list of semantic versions.
[ "Convert", "a", "list", "of", "string", "semantic", "versions", "to", "a", "sorted", "list", "of", "semantic", "versions", "." ]
[ "\"\"\"\n Convert a list of string semantic versions to a sorted list of semantic versions.\n Note: unreleased is not considered as a semantic version and will thus be removed from the resulting versions.\n\n :param versions: un-ordered list of semantic versions (as string). Can contains unreleased.\n :...
[ { "param": "versions", "type": "Iterable[str]" } ]
{ "returns": [ { "docstring": "An ordered (first element is the oldest version, last element is the newest (highest)) list of versions.\nEach version is represented as a 2-tuple: first one is the string version, second one is a dictionary containing:\n'major', 'minor', 'patch', 'prerelease', 'buildmetadata'...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
initialize
null
def initialize(self, session=None): """ Helper for initializing all the variables. Builds and runs model variables and global step initializers. Note that dual variables are initialized only when calling `backward`. :param session: optional tensorflow session (if None default se...
Helper for initializing all the variables. Builds and runs model variables and global step initializers. Note that dual variables are initialized only when calling `backward`. :param session: optional tensorflow session (if None default session is used) :return: None ...
Helper for initializing all the variables. Builds and runs model variables and global step initializers. Note that dual variables are initialized only when calling `backward`.
[ "Helper", "for", "initializing", "all", "the", "variables", ".", "Builds", "and", "runs", "model", "variables", "and", "global", "step", "initializers", ".", "Note", "that", "dual", "variables", "are", "initialized", "only", "when", "calling", "`", "backward", ...
def initialize(self, session=None): ss = session or tf.get_default_session() assert ss, 'No default tensorflow session!' if isinstance(self.w, MergedVariable): self.w.initialize(session=session) else: ss.run(tf.variables_initializer([self.w])) ss.run(tf.va...
[ "def", "initialize", "(", "self", ",", "session", "=", "None", ")", ":", "ss", "=", "session", "or", "tf", ".", "get_default_session", "(", ")", "assert", "ss", ",", "'No default tensorflow session!'", "if", "isinstance", "(", "self", ".", "w", ",", "Merge...
Helper for initializing all the variables.
[ "Helper", "for", "initializing", "all", "the", "variables", "." ]
[ "\"\"\"\n Helper for initializing all the variables. Builds and runs model variables and global step initializers.\n Note that dual variables are initialized only when calling `backward`.\n \n :param session: optional tensorflow session (if None default session is used) \n \n ...
[ { "param": "self", "type": null }, { "param": "session", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
forward
null
def forward(self, T, train_feed_dict_supplier=None, summary_utils=None): """ Performs (forward) optimization of the parameters. :param T: Total number of iterations :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict` ...
Performs (forward) optimization of the parameters. :param T: Total number of iterations :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict` or `() -> feed_dict` to pass to ...
Performs (forward) optimization of the parameters.
[ "Performs", "(", "forward", ")", "optimization", "of", "the", "parameters", "." ]
def forward(self, T, train_feed_dict_supplier=None, summary_utils=None): if not train_feed_dict_supplier: train_feed_dict_supplier = lambda: None ss = tf.get_default_session() self.w_hist.clear() for t in range(T): self.w_hist.append(self.w_t.eval()) s...
[ "def", "forward", "(", "self", ",", "T", ",", "train_feed_dict_supplier", "=", "None", ",", "summary_utils", "=", "None", ")", ":", "if", "not", "train_feed_dict_supplier", ":", "train_feed_dict_supplier", "=", "lambda", ":", "None", "ss", "=", "tf", ".", "g...
Performs (forward) optimization of the parameters.
[ "Performs", "(", "forward", ")", "optimization", "of", "the", "parameters", "." ]
[ "\"\"\"\n Performs (forward) optimization of the parameters.\n\n :param T: Total number of iterations\n :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict`\n or `() -> feed_dict` to pass to\n ...
[ { "param": "self", "type": null }, { "param": "T", "type": null }, { "param": "train_feed_dict_supplier", "type": null }, { "param": "summary_utils", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
backward
<not_specific>
def backward(self, T, val_feed_dict_suppliers=None, train_feed_dict_supplier=None, hyper_batch_step=None, summary_utils=None, check_if_zero=False): """ Performs backward computation of hyper-gradients :param hyper_batch_step: supports for stochastic sampling of validation set ...
Performs backward computation of hyper-gradients :param hyper_batch_step: supports for stochastic sampling of validation set :param T: Total number of iterations :param val_feed_dict_suppliers: either a callable that returns a feed_dict or a dict...
Performs backward computation of hyper-gradients
[ "Performs", "backward", "computation", "of", "hyper", "-", "gradients" ]
def backward(self, T, val_feed_dict_suppliers=None, train_feed_dict_supplier=None, hyper_batch_step=None, summary_utils=None, check_if_zero=False): if not train_feed_dict_supplier: train_feed_dict_supplier = lambda: None if not val_feed_dict_suppliers: val_feed...
[ "def", "backward", "(", "self", ",", "T", ",", "val_feed_dict_suppliers", "=", "None", ",", "train_feed_dict_supplier", "=", "None", ",", "hyper_batch_step", "=", "None", ",", "summary_utils", "=", "None", ",", "check_if_zero", "=", "False", ")", ":", "if", ...
Performs backward computation of hyper-gradients
[ "Performs", "backward", "computation", "of", "hyper", "-", "gradients" ]
[ "\"\"\"\n Performs backward computation of hyper-gradients\n\n :param hyper_batch_step: supports for stochastic sampling of validation set\n :param T: Total number of iterations\n :param val_feed_dict_suppliers: either a callable that returns a feed_dict\n ...
[ { "param": "self", "type": null }, { "param": "T", "type": null }, { "param": "val_feed_dict_suppliers", "type": null }, { "param": "train_feed_dict_supplier", "type": null }, { "param": "hyper_batch_step", "type": null }, { "param": "summary_utils", ...
{ "returns": [ { "docstring": "A dictionary of lists of step-wise hyper-gradients. In usual application the \"true\" hyper-gradients\ncan be obtained with method std_collect_hyper_gradients", "docstring_tokens": [ "A", "dictionary", "of", "lists", "of", ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
run_all
<not_specific>
def run_all(self, T, train_feed_dict_supplier=None, val_feed_dict_suppliers=None, hyper_batch_step=None, forward_su=None, backward_su=None, after_forward_su=None, check_if_zero=False): """ Performs both forward and backward step. See functions `forward` and `backward` for details. ...
Performs both forward and backward step. See functions `forward` and `backward` for details. :param hyper_batch_step: support for stochastic sampling of validation set :param T: Total number of iterations :param train_feed_dict_supplier: (feed_dict) supplier for tra...
Performs both forward and backward step. See functions `forward` and `backward` for details.
[ "Performs", "both", "forward", "and", "backward", "step", ".", "See", "functions", "`", "forward", "`", "and", "`", "backward", "`", "for", "details", "." ]
def run_all(self, T, train_feed_dict_supplier=None, val_feed_dict_suppliers=None, hyper_batch_step=None, forward_su=None, backward_su=None, after_forward_su=None, check_if_zero=False): self.forward(T, train_feed_dict_supplier=train_feed_dict_supplier, summary_utils=forward_su) final_w = ...
[ "def", "run_all", "(", "self", ",", "T", ",", "train_feed_dict_supplier", "=", "None", ",", "val_feed_dict_suppliers", "=", "None", ",", "hyper_batch_step", "=", "None", ",", "forward_su", "=", "None", ",", "backward_su", "=", "None", ",", "after_forward_su", ...
Performs both forward and backward step.
[ "Performs", "both", "forward", "and", "backward", "step", "." ]
[ "\"\"\"\n Performs both forward and backward step. See functions `forward` and `backward` for details.\n\n :param hyper_batch_step: support for stochastic sampling of validation set\n :param T: Total number of iterations\n :param train_feed_dict_supplier: (feed_dict) ...
[ { "param": "self", "type": null }, { "param": "T", "type": null }, { "param": "train_feed_dict_supplier", "type": null }, { "param": "val_feed_dict_suppliers", "type": null }, { "param": "hyper_batch_step", "type": null }, { "param": "forward_su", ...
{ "returns": [ { "docstring": "A dictionary of lists of step-wise hyper-gradients. In usual application the \"true\" hyper-gradients\ncan be obtained with method `std_collect_hyper_gradients`", "docstring_tokens": [ "A", "dictionary", "of", "lists", "of", ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
std_collect_hyper_gradients
<not_specific>
def std_collect_hyper_gradients(row_gradients): """ Sums over all the step-wise hyper-gradients. :param row_gradients: Result of method `backward` :return: Hyper-gradients of validation error w.r.t. "fixed" hyperparameters """ return {hyp: sum([r for r in res[1:]], res[0...
Sums over all the step-wise hyper-gradients. :param row_gradients: Result of method `backward` :return: Hyper-gradients of validation error w.r.t. "fixed" hyperparameters
Sums over all the step-wise hyper-gradients.
[ "Sums", "over", "all", "the", "step", "-", "wise", "hyper", "-", "gradients", "." ]
def std_collect_hyper_gradients(row_gradients): return {hyp: sum([r for r in res[1:]], res[0]) for hyp, res in row_gradients.items()}
[ "def", "std_collect_hyper_gradients", "(", "row_gradients", ")", ":", "return", "{", "hyp", ":", "sum", "(", "[", "r", "for", "r", "in", "res", "[", "1", ":", "]", "]", ",", "res", "[", "0", "]", ")", "for", "hyp", ",", "res", "in", "row_gradients"...
Sums over all the step-wise hyper-gradients.
[ "Sums", "over", "all", "the", "step", "-", "wise", "hyper", "-", "gradients", "." ]
[ "\"\"\"\n Sums over all the step-wise hyper-gradients.\n\n :param row_gradients: Result of method `backward`\n :return: Hyper-gradients of validation error w.r.t. \"fixed\" hyperparameters\n \"\"\"" ]
[ { "param": "row_gradients", "type": null } ]
{ "returns": [ { "docstring": "Hyper-gradients of validation error w.r.t. \"fixed\" hyperparameters", "docstring_tokens": [ "Hyper", "-", "gradients", "of", "validation", "error", "w", ".", "r", ".", "t", "...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
_create_z
<not_specific>
def _create_z(self, hyper): """ Initializer for Z-variables. Used internally. :param hyper: :return: """ shape_h = hyper.get_shape().as_list() assert len(shape_h) < 2, 'only scalar or vector hyper-parameters are accepted: %s shape: %s' % (hyper, shape_h) ...
Initializer for Z-variables. Used internally. :param hyper: :return:
Initializer for Z-variables. Used internally.
[ "Initializer", "for", "Z", "-", "variables", ".", "Used", "internally", "." ]
def _create_z(self, hyper): shape_h = hyper.get_shape().as_list() assert len(shape_h) < 2, 'only scalar or vector hyper-parameters are accepted: %s shape: %s' % (hyper, shape_h) dim_h = shape_h[0] if shape_h else 1 components = self.w.var_list(VlMode.TENSOR) if isinstance(self.w, MergedV...
[ "def", "_create_z", "(", "self", ",", "hyper", ")", ":", "shape_h", "=", "hyper", ".", "get_shape", "(", ")", ".", "as_list", "(", ")", "assert", "len", "(", "shape_h", ")", "<", "2", ",", "'only scalar or vector hyper-parameters are accepted: %s shape: %s'", ...
Initializer for Z-variables.
[ "Initializer", "for", "Z", "-", "variables", "." ]
[ "\"\"\"\n Initializer for Z-variables. Used internally.\n\n :param hyper:\n :return:\n \"\"\"", "# print('components', components)" ]
[ { "param": "self", "type": null }, { "param": "hyper", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
initialize
<not_specific>
def initialize(self, session=None): """ Helper for initializing all the variables. Builds and runs model variables, Zs and global step initializers. :param session: optional tensorflow session (if None default session is used) :return: None """ ...
Helper for initializing all the variables. Builds and runs model variables, Zs and global step initializers. :param session: optional tensorflow session (if None default session is used) :return: None
Helper for initializing all the variables. Builds and runs model variables, Zs and global step initializers.
[ "Helper", "for", "initializing", "all", "the", "variables", ".", "Builds", "and", "runs", "model", "variables", "Zs", "and", "global", "step", "initializers", "." ]
def initialize(self, session=None): ss = session or tf.get_default_session() assert ss, 'No default tensorflow session!' if isinstance(self.w, MergedVariable): self.w.initialize(session=session) else: ss.run(tf.variables_initializer([self.w])) ss.run(tf....
[ "def", "initialize", "(", "self", ",", "session", "=", "None", ")", ":", "ss", "=", "session", "or", "tf", ".", "get_default_session", "(", ")", "assert", "ss", ",", "'No default tensorflow session!'", "if", "isinstance", "(", "self", ".", "w", ",", "Merge...
Helper for initializing all the variables.
[ "Helper", "for", "initializing", "all", "the", "variables", "." ]
[ "\"\"\"\n Helper for initializing all the variables. Builds and runs model variables, \n Zs and global step initializers.\n \n :param session: optional tensorflow session (if None default session is used) \n \n :return: None\n \"\"\"", "# never tested" ]
[ { "param": "self", "type": null }, { "param": "session", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
step_forward
<not_specific>
def step_forward(self, train_feed_dict_supplier=None, summary_utils=None): """ Updates for one step both model parameters (according to the optimizer dynamics) and Z-variables. :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict` to pass to ...
Updates for one step both model parameters (according to the optimizer dynamics) and Z-variables. :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict` to pass to `tf.Session.run` feed...
Updates for one step both model parameters (according to the optimizer dynamics) and Z-variables.
[ "Updates", "for", "one", "step", "both", "model", "parameters", "(", "according", "to", "the", "optimizer", "dynamics", ")", "and", "Z", "-", "variables", "." ]
def step_forward(self, train_feed_dict_supplier=None, summary_utils=None): if not train_feed_dict_supplier: train_feed_dict_supplier = lambda: None ss = tf.get_default_session() fd = cmo(train_feed_dict_supplier, self.global_step.eval()) ss.run(self._zs_assigns, feed_dict=fd)...
[ "def", "step_forward", "(", "self", ",", "train_feed_dict_supplier", "=", "None", ",", "summary_utils", "=", "None", ")", ":", "if", "not", "train_feed_dict_supplier", ":", "train_feed_dict_supplier", "=", "lambda", ":", "None", "ss", "=", "tf", ".", "get_defaul...
Updates for one step both model parameters (according to the optimizer dynamics) and Z-variables.
[ "Updates", "for", "one", "step", "both", "model", "parameters", "(", "according", "to", "the", "optimizer", "dynamics", ")", "and", "Z", "-", "variables", "." ]
[ "\"\"\"\n Updates for one step both model parameters (according to the optimizer dynamics) and\n Z-variables.\n\n :param train_feed_dict_supplier: (optional) A callable with signature `t -> feed_dict` to pass to\n `tf.Session.run`\n ...
[ { "param": "self", "type": null }, { "param": "train_feed_dict_supplier", "type": null }, { "param": "summary_utils", "type": null } ]
{ "returns": [ { "docstring": "feed dictionary for this step", "docstring_tokens": [ "feed", "dictionary", "for", "this", "step" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "doc...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
hyper_gradients
<not_specific>
def hyper_gradients(self, val_feed_dict_supplier=None, hyper_batch_step=None): """ Method that computes the hyper-gradient. :param hyper_batch_step: support for stochastic sampling of validation points :param val_feed_dict_supplier: single supplier or list of suppliers for the examples...
Method that computes the hyper-gradient. :param hyper_batch_step: support for stochastic sampling of validation points :param val_feed_dict_supplier: single supplier or list of suppliers for the examples in the validation set :return: Dictionary: {hyper-parameter: hyper-gradient} or ...
Method that computes the hyper-gradient.
[ "Method", "that", "computes", "the", "hyper", "-", "gradient", "." ]
def hyper_gradients(self, val_feed_dict_supplier=None, hyper_batch_step=None): if not isinstance(val_feed_dict_supplier, dict) and len(self.hyper_list) == 1: val_feed_dict_supplier = {self.hyper_list[0]: val_feed_dict_supplier} val_sup_lst = [] if val_feed_dict_supplier is None: ...
[ "def", "hyper_gradients", "(", "self", ",", "val_feed_dict_supplier", "=", "None", ",", "hyper_batch_step", "=", "None", ")", ":", "if", "not", "isinstance", "(", "val_feed_dict_supplier", ",", "dict", ")", "and", "len", "(", "self", ".", "hyper_list", ")", ...
Method that computes the hyper-gradient.
[ "Method", "that", "computes", "the", "hyper", "-", "gradient", "." ]
[ "\"\"\"\n Method that computes the hyper-gradient.\n\n :param hyper_batch_step: support for stochastic sampling of validation points\n :param val_feed_dict_supplier: single supplier or list of suppliers for the examples in the validation set\n\n :return: Dictionary: {hyper-parameter: hy...
[ { "param": "self", "type": null }, { "param": "val_feed_dict_supplier", "type": null }, { "param": "hyper_batch_step", "type": null } ]
{ "returns": [ { "docstring": "{hyper-parameter: hyper-gradient} or None in new_mode", "docstring_tokens": [ "{", "hyper", "-", "parameter", ":", "hyper", "-", "gradient", "}", "or", "None", "in", "...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
initialize
<not_specific>
def initialize(self, session=None, complete_reinitialize=False): """ Initialize all tensorflow variables. This method has two behaviours: - first time it is called (after entering a Session run block) or when flag `complete_reinitialize` is `True` initializes all the relevant variab...
Initialize all tensorflow variables. This method has two behaviours: - first time it is called (after entering a Session run block) or when flag `complete_reinitialize` is `True` initializes all the relevant variables - subsequent times, reinitialize only model variables (next hype...
Initialize all tensorflow variables. This method has two behaviours: first time it is called (after entering a Session run block) or when flag `complete_reinitialize` is `True` initializes all the relevant variables subsequent times, reinitialize only model variables (next hyper-iteration). :return: True if this is ...
[ "Initialize", "all", "tensorflow", "variables", ".", "This", "method", "has", "two", "behaviours", ":", "first", "time", "it", "is", "called", "(", "after", "entering", "a", "Session", "run", "block", ")", "or", "when", "flag", "`", "complete_reinitialize", ...
def initialize(self, session=None, complete_reinitialize=False): ss = tf.get_default_session() assert ss, 'No default session.' never_initialized = bool(self._report_hyper_it_init.eval()) if complete_reinitialize or never_initialized: tf.variables_initializer(self.hyper_gra...
[ "def", "initialize", "(", "self", ",", "session", "=", "None", ",", "complete_reinitialize", "=", "False", ")", ":", "ss", "=", "tf", ".", "get_default_session", "(", ")", "assert", "ss", ",", "'No default session.'", "never_initialized", "=", "bool", "(", "...
Initialize all tensorflow variables.
[ "Initialize", "all", "tensorflow", "variables", "." ]
[ "\"\"\"\n Initialize all tensorflow variables. This method has two behaviours:\n\n - first time it is called (after entering a Session run block) or when flag `complete_reinitialize` is `True`\n initializes all the relevant variables\n - subsequent times, reinitialize only model vari...
[ { "param": "self", "type": null }, { "param": "session", "type": null }, { "param": "complete_reinitialize", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "session", "type": null, "docstring": null, "docstring_tokens"...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
create_hyperparameter_optimizers
<not_specific>
def create_hyperparameter_optimizers(rf_hyper_gradients, optimizer_class, **optimizers_kw_args): """ Helper for creating descent procedure for hyperparameters :param rf_hyper_gradients: instance of `ForwardHG` or `ReverseHG` class :param optimizer_class: callable for instantiating the single optimizer...
Helper for creating descent procedure for hyperparameters :param rf_hyper_gradients: instance of `ForwardHG` or `ReverseHG` class :param optimizer_class: callable for instantiating the single optimizers :param optimizers_kw_args: arguments to pass to `optimizer_creator` :return: List of `Optimize...
Helper for creating descent procedure for hyperparameters
[ "Helper", "for", "creating", "descent", "procedure", "for", "hyperparameters" ]
def create_hyperparameter_optimizers(rf_hyper_gradients, optimizer_class, **optimizers_kw_args): assert issubclass(optimizer_class, Optimizer), '%s should be an Optimizer' % optimizer_class return [optimizer_class.create(hyp, **optimizers_kw_args, grad=hg, w_is_state=False) for hyp, hg in zip(rf_hyp...
[ "def", "create_hyperparameter_optimizers", "(", "rf_hyper_gradients", ",", "optimizer_class", ",", "**", "optimizers_kw_args", ")", ":", "assert", "issubclass", "(", "optimizer_class", ",", "Optimizer", ")", ",", "'%s should be an Optimizer'", "%", "optimizer_class", "ret...
Helper for creating descent procedure for hyperparameters
[ "Helper", "for", "creating", "descent", "procedure", "for", "hyperparameters" ]
[ "\"\"\"\n Helper for creating descent procedure for hyperparameters\n\n :param rf_hyper_gradients: instance of `ForwardHG` or `ReverseHG` class\n :param optimizer_class: callable for instantiating the single optimizers\n :param optimizers_kw_args: arguments to pass to `optimizer_creator`\n :return: ...
[ { "param": "rf_hyper_gradients", "type": null }, { "param": "optimizer_class", "type": null } ]
{ "returns": [ { "docstring": "List of `Optimizer` objects", "docstring_tokens": [ "List", "of", "`", "Optimizer", "`", "objects" ], "type": null } ], "raises": [], "params": [ { "identifier": "rf_hyper_gradients", "...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
positivity
<not_specific>
def positivity(hyper_list): """ Simple positivity constraints for a list of hyperparameters :param hyper_list: single variable or list of variable (hyperparameters) :return: single or list of assign ops, one for each variable in `hyper_list` """ lst = [hyp.assign(tf.maximum(hyp, tf.zeros_like(h...
Simple positivity constraints for a list of hyperparameters :param hyper_list: single variable or list of variable (hyperparameters) :return: single or list of assign ops, one for each variable in `hyper_list`
Simple positivity constraints for a list of hyperparameters
[ "Simple", "positivity", "constraints", "for", "a", "list", "of", "hyperparameters" ]
def positivity(hyper_list): lst = [hyp.assign(tf.maximum(hyp, tf.zeros_like(hyp))) for hyp in as_list(hyper_list)] return lst if len(lst) > 1 else lst[0]
[ "def", "positivity", "(", "hyper_list", ")", ":", "lst", "=", "[", "hyp", ".", "assign", "(", "tf", ".", "maximum", "(", "hyp", ",", "tf", ".", "zeros_like", "(", "hyp", ")", ")", ")", "for", "hyp", "in", "as_list", "(", "hyper_list", ")", "]", "...
Simple positivity constraints for a list of hyperparameters
[ "Simple", "positivity", "constraints", "for", "a", "list", "of", "hyperparameters" ]
[ "\"\"\"\n Simple positivity constraints for a list of hyperparameters\n\n :param hyper_list: single variable or list of variable (hyperparameters)\n :return: single or list of assign ops, one for each variable in `hyper_list`\n \"\"\"" ]
[ { "param": "hyper_list", "type": null } ]
{ "returns": [ { "docstring": "single or list of assign ops, one for each variable in `hyper_list`", "docstring_tokens": [ "single", "or", "list", "of", "assign", "ops", "one", "for", "each", "variable", "in", ...
52b137d60af8df0e6e3545f71bbdbf58517474b8
lucfra/RFHO
rfho/hyper_gradients.py
[ "MIT" ]
Python
print_hyper_gradients
null
def print_hyper_gradients(hyper_gradient_dict): # TODO to be removed """ Old helper function to nicely print hyper-gradients :param hyper_gradient_dict: :return: """ for k, v in hyper_gradient_dict.items(): print(k.name, v)
Old helper function to nicely print hyper-gradients :param hyper_gradient_dict: :return:
Old helper function to nicely print hyper-gradients
[ "Old", "helper", "function", "to", "nicely", "print", "hyper", "-", "gradients" ]
def print_hyper_gradients(hyper_gradient_dict): for k, v in hyper_gradient_dict.items(): print(k.name, v)
[ "def", "print_hyper_gradients", "(", "hyper_gradient_dict", ")", ":", "for", "k", ",", "v", "in", "hyper_gradient_dict", ".", "items", "(", ")", ":", "print", "(", "k", ".", "name", ",", "v", ")" ]
Old helper function to nicely print hyper-gradients
[ "Old", "helper", "function", "to", "nicely", "print", "hyper", "-", "gradients" ]
[ "# TODO to be removed", "\"\"\"\n Old helper function to nicely print hyper-gradients\n\n :param hyper_gradient_dict:\n :return:\n \"\"\"" ]
[ { "param": "hyper_gradient_dict", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "hyper_gradient_dict", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default...
238e43317607e3294d617e6d932e90e49335b40c
lucfra/RFHO
rfho/optimizers.py
[ "MIT" ]
Python
support_variables_initializer
<not_specific>
def support_variables_initializer(self): """ Returns an initialization op for the support variables (like velocity for momentum) :return: """ return tf.variables_initializer(self.get_support_variables())
Returns an initialization op for the support variables (like velocity for momentum) :return:
Returns an initialization op for the support variables (like velocity for momentum)
[ "Returns", "an", "initialization", "op", "for", "the", "support", "variables", "(", "like", "velocity", "for", "momentum", ")" ]
def support_variables_initializer(self): return tf.variables_initializer(self.get_support_variables())
[ "def", "support_variables_initializer", "(", "self", ")", ":", "return", "tf", ".", "variables_initializer", "(", "self", ".", "get_support_variables", "(", ")", ")" ]
Returns an initialization op for the support variables (like velocity for momentum)
[ "Returns", "an", "initialization", "op", "for", "the", "support", "variables", "(", "like", "velocity", "for", "momentum", ")" ]
[ "\"\"\"\n Returns an initialization op for the support variables (like velocity for momentum)\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
238e43317607e3294d617e6d932e90e49335b40c
lucfra/RFHO
rfho/optimizers.py
[ "MIT" ]
Python
increase_global_step
null
def increase_global_step(self): """ If there is a global step, increases it :return: """ pass
If there is a global step, increases it :return:
If there is a global step, increases it
[ "If", "there", "is", "a", "global", "step", "increases", "it" ]
def increase_global_step(self): pass
[ "def", "increase_global_step", "(", "self", ")", ":", "pass" ]
If there is a global step, increases it
[ "If", "there", "is", "a", "global", "step", "increases", "it" ]
[ "\"\"\"\n If there is a global step, increases it\n\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
238e43317607e3294d617e6d932e90e49335b40c
lucfra/RFHO
rfho/optimizers.py
[ "MIT" ]
Python
d_dynamics_d_hyper_loss
<not_specific>
def d_dynamics_d_hyper_loss(self, grad_loss_term, name): """ Helper function for building the partial derivative of the dynamics w.r.t. an hyperparameter inside the loss function, given the gradient or Jacobian of loss w.r.t. :param name: name of the resulting MergedMatrix :para...
Helper function for building the partial derivative of the dynamics w.r.t. an hyperparameter inside the loss function, given the gradient or Jacobian of loss w.r.t. :param name: name of the resulting MergedMatrix :param grad_loss_term: should be \nabla R :return: Partial deriva...
Helper function for building the partial derivative of the dynamics w.r.t. an hyperparameter inside the loss function, given the gradient or Jacobian of loss w.r.t.
[ "Helper", "function", "for", "building", "the", "partial", "derivative", "of", "the", "dynamics", "w", ".", "r", ".", "t", ".", "an", "hyperparameter", "inside", "the", "loss", "function", "given", "the", "gradient", "or", "Jacobian", "of", "loss", "w", "....
def d_dynamics_d_hyper_loss(self, grad_loss_term, name): return ZMergedMatrix(-self.learning_rate * grad_loss_term, name=name)
[ "def", "d_dynamics_d_hyper_loss", "(", "self", ",", "grad_loss_term", ",", "name", ")", ":", "return", "ZMergedMatrix", "(", "-", "self", ".", "learning_rate", "*", "grad_loss_term", ",", "name", "=", "name", ")" ]
Helper function for building the partial derivative of the dynamics w.r.t.
[ "Helper", "function", "for", "building", "the", "partial", "derivative", "of", "the", "dynamics", "w", ".", "r", ".", "t", "." ]
[ "\"\"\"\n Helper function for building the partial derivative of the dynamics w.r.t. an hyperparameter\n inside the loss function, given the gradient or Jacobian of loss w.r.t.\n\n :param name: name of the resulting MergedMatrix\n :param grad_loss_term: should be \\nabla R\n :retu...
[ { "param": "self", "type": null }, { "param": "grad_loss_term", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": "Partial derivative of dynamics w.r.t. weighting hyperparameter", "docstring_tokens": [ "Partial", "derivative", "of", "dynamics", "w", ".", "r", ".", "t", ".", "weighting", "h...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
pvars
null
def pvars(_vars, _tabs=0): """utility function to print the arg variables""" if do_print: print('\t' * _tabs, '-' * 10, 'START', '-' * 10) for k, v in _vars.items(): print('\t' * _tabs, k, ':', v) print('\t' * _tabs, '-' * 10, 'END', '-' * 10)
utility function to print the arg variables
utility function to print the arg variables
[ "utility", "function", "to", "print", "the", "arg", "variables" ]
def pvars(_vars, _tabs=0): if do_print: print('\t' * _tabs, '-' * 10, 'START', '-' * 10) for k, v in _vars.items(): print('\t' * _tabs, k, ':', v) print('\t' * _tabs, '-' * 10, 'END', '-' * 10)
[ "def", "pvars", "(", "_vars", ",", "_tabs", "=", "0", ")", ":", "if", "do_print", ":", "print", "(", "'\\t'", "*", "_tabs", ",", "'-'", "*", "10", ",", "'START'", ",", "'-'", "*", "10", ")", "for", "k", ",", "v", "in", "_vars", ".", "items", ...
utility function to print the arg variables
[ "utility", "function", "to", "print", "the", "arg", "variables" ]
[ "\"\"\"utility function to print the arg variables\"\"\"" ]
[ { "param": "_vars", "type": null }, { "param": "_tabs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "_vars", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "_tabs", "type": null, "docstring": null, "docstring_tokens":...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
convolutional_layer_2d
<not_specific>
def convolutional_layer_2d(init_w=None, init_b=tf.zeros, strides=(1, 1, 1, 1), padding='SAME', act=tf.nn.relu): """ Helper function for 2d convolutional layer :param padding: :param init_w: :param init_b: :param strides: :param act: :return: an initializer ...
Helper function for 2d convolutional layer :param padding: :param init_w: :param init_b: :param strides: :param act: :return: an initializer
Helper function for 2d convolutional layer
[ "Helper", "function", "for", "2d", "convolutional", "layer" ]
def convolutional_layer_2d(init_w=None, init_b=tf.zeros, strides=(1, 1, 1, 1), padding='SAME', act=tf.nn.relu): if init_w is None: init_w = lambda shape: tf.truncated_normal(shape, stddev=.1) def _init(_input, shape): _W = create_or_reuse(init_w, shape, name='W') _b = ...
[ "def", "convolutional_layer_2d", "(", "init_w", "=", "None", ",", "init_b", "=", "tf", ".", "zeros", ",", "strides", "=", "(", "1", ",", "1", ",", "1", ",", "1", ")", ",", "padding", "=", "'SAME'", ",", "act", "=", "tf", ".", "nn", ".", "relu", ...
Helper function for 2d convolutional layer
[ "Helper", "function", "for", "2d", "convolutional", "layer" ]
[ "\"\"\"\n Helper function for 2d convolutional layer\n\n :param padding:\n :param init_w:\n :param init_b:\n :param strides:\n :param act:\n :return: an initializer\n \"\"\"" ]
[ { "param": "init_w", "type": null }, { "param": "init_b", "type": null }, { "param": "strides", "type": null }, { "param": "padding", "type": null }, { "param": "act", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "init_w", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
create_or_reuse
<not_specific>
def create_or_reuse(init_or_variable, shape, name='var'): """ Creates a variable given a shape or does nothing if `init_or_variable` is already a Variable. :param init_or_variable: :param shape: :param name: :return: """ return init_or_variable if isinstance(init_or_variable, tf.Variabl...
Creates a variable given a shape or does nothing if `init_or_variable` is already a Variable. :param init_or_variable: :param shape: :param name: :return:
Creates a variable given a shape or does nothing if `init_or_variable` is already a Variable.
[ "Creates", "a", "variable", "given", "a", "shape", "or", "does", "nothing", "if", "`", "init_or_variable", "`", "is", "already", "a", "Variable", "." ]
def create_or_reuse(init_or_variable, shape, name='var'): return init_or_variable if isinstance(init_or_variable, tf.Variable) \ else tf.Variable(init_or_variable(shape), name=name)
[ "def", "create_or_reuse", "(", "init_or_variable", ",", "shape", ",", "name", "=", "'var'", ")", ":", "return", "init_or_variable", "if", "isinstance", "(", "init_or_variable", ",", "tf", ".", "Variable", ")", "else", "tf", ".", "Variable", "(", "init_or_varia...
Creates a variable given a shape or does nothing if `init_or_variable` is already a Variable.
[ "Creates", "a", "variable", "given", "a", "shape", "or", "does", "nothing", "if", "`", "init_or_variable", "`", "is", "already", "a", "Variable", "." ]
[ "\"\"\"\n Creates a variable given a shape or does nothing if `init_or_variable` is already a Variable.\n\n :param init_or_variable:\n :param shape:\n :param name:\n :return:\n \"\"\"" ]
[ { "param": "init_or_variable", "type": null }, { "param": "shape", "type": null }, { "param": "name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "init_or_variable", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": ...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
vectorize_model
<not_specific>
def vectorize_model(model_vars, *o_outs, augment=0, suppress_err_out=True): """ Function that "vectorizes" a model (as a computation graph). Given a model written in a "standard way", i.e. with parameters organized in k-rank tensors as needed (matrices and vectors for linearities, 3 or 4 rank tensors ...
Function that "vectorizes" a model (as a computation graph). Given a model written in a "standard way", i.e. with parameters organized in k-rank tensors as needed (matrices and vectors for linearities, 3 or 4 rank tensors for convolutional kernels etc.), returns the same model with all the parameters...
Function that "vectorizes" a model (as a computation graph). Given a model written in a "standard way", i.e. with parameters organized in k-rank tensors as needed (matrices and vectors for linearities, 3 or 4 rank tensors for convolutional kernels etc.), returns the same model with all the parameters organized in a si...
[ "Function", "that", "\"", "vectorizes", "\"", "a", "model", "(", "as", "a", "computation", "graph", ")", ".", "Given", "a", "model", "written", "in", "a", "\"", "standard", "way", "\"", "i", ".", "e", ".", "with", "parameters", "organized", "in", "k", ...
def vectorize_model(model_vars, *o_outs, augment=0, suppress_err_out=True): assert len(model_vars) > 0, 'no variables in model_vars!' outs = [tf.identity(o) if isinstance(o, tf.Variable) else o for o in o_outs] with model_vars[0].graph.as_default(): true_w = MergedVariable(model_vars) if aug...
[ "def", "vectorize_model", "(", "model_vars", ",", "*", "o_outs", ",", "augment", "=", "0", ",", "suppress_err_out", "=", "True", ")", ":", "assert", "len", "(", "model_vars", ")", ">", "0", ",", "'no variables in model_vars!'", "outs", "=", "[", "tf", ".",...
Function that "vectorizes" a model (as a computation graph).
[ "Function", "that", "\"", "vectorizes", "\"", "a", "model", "(", "as", "a", "computation", "graph", ")", "." ]
[ "\"\"\"\n Function that \"vectorizes\" a model (as a computation graph).\n\n Given a model written in a \"standard way\", i.e. with parameters organized in k-rank tensors as needed\n (matrices and vectors for linearities, 3 or 4 rank tensors for convolutional kernels etc.), returns the same model\n wit...
[ { "param": "model_vars", "type": null }, { "param": "augment", "type": null }, { "param": "suppress_err_out", "type": null } ]
{ "returns": [ { "docstring": "a list which has as first element the `MergedVariable` that represents the all weights vector. Remaining\nelements are the outputs\nin the modified graph. These new outs are the same computed by the initial model\n(by the computation graph in which the model lives) but with de...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
for_input
null
def for_input(self, new_input, new_name=None): """ Returns the same model computed on an other input... :param new_input: :param new_name: :return: """ raise NotImplementedError()
Returns the same model computed on an other input... :param new_input: :param new_name: :return:
Returns the same model computed on an other input
[ "Returns", "the", "same", "model", "computed", "on", "an", "other", "input" ]
def for_input(self, new_input, new_name=None): raise NotImplementedError()
[ "def", "for_input", "(", "self", ",", "new_input", ",", "new_name", "=", "None", ")", ":", "raise", "NotImplementedError", "(", ")" ]
Returns the same model computed on an other input...
[ "Returns", "the", "same", "model", "computed", "on", "an", "other", "input", "..." ]
[ "\"\"\"\n Returns the same model computed on an other input...\n\n :param new_input:\n :param new_name:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "new_input", "type": null }, { "param": "new_name", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
initialize
null
def initialize(self, session=None): """ Initialize the model. If `deterministic_initialization` is set to true, saves the initial weight in numpy which will be used for subsequent initialization. This is because random seed management in tensorflow is rather obscure... and I could not ...
Initialize the model. If `deterministic_initialization` is set to true, saves the initial weight in numpy which will be used for subsequent initialization. This is because random seed management in tensorflow is rather obscure... and I could not find a way to set the same seed across d...
Initialize the model. If `deterministic_initialization` is set to true, saves the initial weight in numpy which will be used for subsequent initialization. This is because random seed management in tensorflow is rather obscure... and I could not find a way to set the same seed across different initialization without ex...
[ "Initialize", "the", "model", ".", "If", "`", "deterministic_initialization", "`", "is", "set", "to", "true", "saves", "the", "initial", "weight", "in", "numpy", "which", "will", "be", "used", "for", "subsequent", "initialization", ".", "This", "is", "because"...
def initialize(self, session=None): ss = session or tf.get_default_session() assert ss, 'No default session' if not self._var_initializer_op: self._var_initializer_op = tf.variables_initializer(self.var_list) ss.run(self._var_initializer_op) if self.deterministic_init...
[ "def", "initialize", "(", "self", ",", "session", "=", "None", ")", ":", "ss", "=", "session", "or", "tf", ".", "get_default_session", "(", ")", "assert", "ss", ",", "'No default session'", "if", "not", "self", ".", "_var_initializer_op", ":", "self", ".",...
Initialize the model.
[ "Initialize", "the", "model", "." ]
[ "\"\"\"\n Initialize the model. If `deterministic_initialization` is set to true, \n saves the initial weight in numpy which will be used for subsequent initialization.\n This is because random seed management in tensorflow is rather obscure... and I could not\n find a way to set the sam...
[ { "param": "self", "type": null }, { "param": "session", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
1c0ca7393fdc1049a692d4f06b48f4b27706f3fe
lucfra/RFHO
rfho/models.py
[ "MIT" ]
Python
vectorize
<not_specific>
def vectorize(self, *outs, augment=0): """ Calls `vectorize_model` with the variables of this model and specified outputs. Moreover it registers this model on the resulting `MergedVariable` and the resulting merged variable in the model as the attribute `self.w`. (See `vectorize...
Calls `vectorize_model` with the variables of this model and specified outputs. Moreover it registers this model on the resulting `MergedVariable` and the resulting merged variable in the model as the attribute `self.w`. (See `vectorize_model` and `mergedVariable`) :param outs...
Calls `vectorize_model` with the variables of this model and specified outputs. Moreover it registers this model on the resulting `MergedVariable` and the resulting merged variable in the model as the attribute `self.w`. (See `vectorize_model` and `mergedVariable`)
[ "Calls", "`", "vectorize_model", "`", "with", "the", "variables", "of", "this", "model", "and", "specified", "outputs", ".", "Moreover", "it", "registers", "this", "model", "on", "the", "resulting", "`", "MergedVariable", "`", "and", "the", "resulting", "merge...
def vectorize(self, *outs, augment=0): res = vectorize_model(self.var_list, *outs, augment=augment) res[0].model = self self.w = res[0] return res
[ "def", "vectorize", "(", "self", ",", "*", "outs", ",", "augment", "=", "0", ")", ":", "res", "=", "vectorize_model", "(", "self", ".", "var_list", ",", "*", "outs", ",", "augment", "=", "augment", ")", "res", "[", "0", "]", ".", "model", "=", "s...
Calls `vectorize_model` with the variables of this model and specified outputs.
[ "Calls", "`", "vectorize_model", "`", "with", "the", "variables", "of", "this", "model", "and", "specified", "outputs", "." ]
[ "\"\"\"\n Calls `vectorize_model` with the variables of this model and specified outputs.\n Moreover it registers this model on the resulting `MergedVariable` and the resulting merged variable \n in the model as the attribute `self.w`.\n (See `vectorize_model` and `mergedVariable`)\n\n ...
[ { "param": "self", "type": null }, { "param": "augment", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
59e841d7156e72b3aaa1de58554e4f5ee1a3837f
lucfra/RFHO
rfho/examples/mnist_deep_ho.py
[ "MIT" ]
Python
deepnn
<not_specific>
def deepnn(x): """deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), ...
deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with values eq...
deepnn builds the graph for a deep net for classifying digits. Args: x: an input tensor with the dimensions (N_examples, 784), where 784 is the number of pixels in a standard MNIST image. Returns: A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with values equal to the logits of classifying the digit i...
[ "deepnn", "builds", "the", "graph", "for", "a", "deep", "net", "for", "classifying", "digits", ".", "Args", ":", "x", ":", "an", "input", "tensor", "with", "the", "dimensions", "(", "N_examples", "784", ")", "where", "784", "is", "the", "number", "of", ...
def deepnn(x): x_image = tf.reshape(x, [-1, 28, 28, 1]) W_conv1 = weight_variable([5, 5, 1, 32]) b_conv1 = bias_variable([32]) h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1) h_pool1 = max_pool_2x2(h_conv1) W_conv2 = weight_variable([5, 5, 32, 64]) b_conv2 = bias_variable([64]) ...
[ "def", "deepnn", "(", "x", ")", ":", "x_image", "=", "tf", ".", "reshape", "(", "x", ",", "[", "-", "1", ",", "28", ",", "28", ",", "1", "]", ")", "W_conv1", "=", "weight_variable", "(", "[", "5", ",", "5", ",", "1", ",", "32", "]", ")", ...
deepnn builds the graph for a deep net for classifying digits.
[ "deepnn", "builds", "the", "graph", "for", "a", "deep", "net", "for", "classifying", "digits", "." ]
[ "\"\"\"deepnn builds the graph for a deep net for classifying digits.\n Args:\n x: an input tensor with the dimensions (N_examples, 784), where 784 is the\n number of pixels in a standard MNIST image.\n Returns:\n A tuple (y, keep_prob). y is a tensor of shape (N_examples, 10), with v...
[ { "param": "x", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
59e841d7156e72b3aaa1de58554e4f5ee1a3837f
lucfra/RFHO
rfho/examples/mnist_deep_ho.py
[ "MIT" ]
Python
main
<not_specific>
def main(_): """ Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being optimized are learning rate for ADAM optimizer and coefficient of L2 norm of fully connected part of the network. Note that this codes requires...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being optimized are learning rate for ADAM optimizer and coefficient of L2 norm of fully connected part of the network. Note that this codes requires ~ 3x (gpu) memory a...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being optimized are learning rate for ADAM optimizer and coefficient of L2 norm of fully connected part of the network. Note that this codes requires ~ 3x (gpu) memory and ~ 4x time comp...
[ "Modified", "MNIST", "for", "expert", "(", "CNN", "part", ")", "tensorflow", "tutorial", "experiment", "to", "include", "real", "time", "hyperparameter", "optimization", ".", "Hyperparameters", "being", "optimized", "are", "learning", "rate", "for", "ADAM", "optim...
def main(_): mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True) x = tf.placeholder(tf.float32, [None, 784]) y_ = tf.placeholder(tf.float32, [None, 10]) y_conv, W_fc1, W_fc2 = deepnn(x) model_vairables = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES) optimizer = rf.AdamOptimizer ...
[ "def", "main", "(", "_", ")", ":", "mnist", "=", "input_data", ".", "read_data_sets", "(", "FLAGS", ".", "data_dir", ",", "one_hot", "=", "True", ")", "x", "=", "tf", ".", "placeholder", "(", "tf", ".", "float32", ",", "[", "None", ",", "784", "]",...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization.
[ "Modified", "MNIST", "for", "expert", "(", "CNN", "part", ")", "tensorflow", "tutorial", "experiment", "to", "include", "real", "time", "hyperparameter", "optimization", "." ]
[ "\"\"\"\n Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time\n hyperparameter optimization. Hyperparameters being optimized are learning rate for\n ADAM optimizer and coefficient of L2 norm of fully connected part of the network.\n Note that this codes requires ~ 3x...
[ { "param": "_", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "_", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "is...
59e841d7156e72b3aaa1de58554e4f5ee1a3837f
lucfra/RFHO
rfho/examples/mnist_deep_ho.py
[ "MIT" ]
Python
experiment
<not_specific>
def experiment(mnist, optimizer=rf.AdamOptimizer, optimizer_kwargs=None, hyper_batch_size=100, T=200, hyper_learning_rate=1.e-4, use_mse=False): """ Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being opti...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being optimized are learning rate for ADAM optimizer and coefficient of L2 norm of fully connected part of the network. Note that this codes requires ~ 3x (gpu) memory a...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization. Hyperparameters being optimized are learning rate for ADAM optimizer and coefficient of L2 norm of fully connected part of the network. Note that this codes requires ~ 3x (gpu) memory and ~ 4x time comp...
[ "Modified", "MNIST", "for", "expert", "(", "CNN", "part", ")", "tensorflow", "tutorial", "experiment", "to", "include", "real", "time", "hyperparameter", "optimization", ".", "Hyperparameters", "being", "optimized", "are", "learning", "rate", "for", "ADAM", "optim...
def experiment(mnist, optimizer=rf.AdamOptimizer, optimizer_kwargs=None, hyper_batch_size=100, T=200, hyper_learning_rate=1.e-4, use_mse=False): x = tf.placeholder(tf.float32, [None, 784], name='x') y_ = tf.placeholder(tf.float32, [None, 10], name='y') y_conv, W_fc1, W_fc2 = deepnn(x) mod...
[ "def", "experiment", "(", "mnist", ",", "optimizer", "=", "rf", ".", "AdamOptimizer", ",", "optimizer_kwargs", "=", "None", ",", "hyper_batch_size", "=", "100", ",", "T", "=", "200", ",", "hyper_learning_rate", "=", "1.e-4", ",", "use_mse", "=", "False", "...
Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time hyperparameter optimization.
[ "Modified", "MNIST", "for", "expert", "(", "CNN", "part", ")", "tensorflow", "tutorial", "experiment", "to", "include", "real", "time", "hyperparameter", "optimization", "." ]
[ "\"\"\"\n Modified MNIST for expert (CNN part) tensorflow tutorial experiment to include real time\n hyperparameter optimization. Hyperparameters being optimized are learning rate for\n ADAM optimizer and coefficient of L2 norm of fully connected part of the network.\n Note that this codes requires ~ 3x...
[ { "param": "mnist", "type": null }, { "param": "optimizer", "type": null }, { "param": "optimizer_kwargs", "type": null }, { "param": "hyper_batch_size", "type": null }, { "param": "T", "type": null }, { "param": "hyper_learning_rate", "type": null...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "mnist", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
d9c83a9103c76a660c999e607f8e508d0ecb4112
lucfra/RFHO
rfho/examples/all_methods_on_mnist.py
[ "MIT" ]
Python
experiment_no_saver
<not_specific>
def experiment_no_saver(datasets=None, model='log_reg', model_kwargs=None, l1=0., l2=0., synthetic_hypers=None, set_T=None, optimizer=rf.MomentumOptimizer, optimizer_kwargs=None, batch_size=200, algo_hyper_wrt_tr_error=False, ...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package. :param datasets: (some dataset, usually MNIST....) :param model: (default logarithmic regression) model type :param model_kwargs: :param l1: Initial value for l1 regularizer weight (if None does not uses...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package.
[ "General", "method", "for", "conducting", "various", "simple", "experiments", "(", "on", "MNIST", "dataset", ")", "with", "RFHO", "package", "." ]
def experiment_no_saver(datasets=None, model='log_reg', model_kwargs=None, l1=0., l2=0., synthetic_hypers=None, set_T=None, optimizer=rf.MomentumOptimizer, optimizer_kwargs=None, batch_size=200, algo_hyper_wrt_tr_error=False, ...
[ "def", "experiment_no_saver", "(", "datasets", "=", "None", ",", "model", "=", "'log_reg'", ",", "model_kwargs", "=", "None", ",", "l1", "=", "0.", ",", "l2", "=", "0.", ",", "synthetic_hypers", "=", "None", ",", "set_T", "=", "None", ",", "optimizer", ...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package.
[ "General", "method", "for", "conducting", "various", "simple", "experiments", "(", "on", "MNIST", "dataset", ")", "with", "RFHO", "package", "." ]
[ "\"\"\"\n General method for conducting various simple experiments (on MNIST dataset) with RFHO package.\n\n :param datasets: (some dataset, usually MNIST....)\n :param model: (default logarithmic regression) model type\n :param model_kwargs:\n :param l1: Initial value for l1 regularizer weight (if N...
[ { "param": "datasets", "type": null }, { "param": "model", "type": null }, { "param": "model_kwargs", "type": null }, { "param": "l1", "type": null }, { "param": "l2", "type": null }, { "param": "synthetic_hypers", "type": null }, { "param"...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "datasets", "type": null, "docstring": "(some dataset, usually MNIST....)", "docstring_tokens": [ "(", ...
d9c83a9103c76a660c999e607f8e508d0ecb4112
lucfra/RFHO
rfho/examples/all_methods_on_mnist.py
[ "MIT" ]
Python
experiment
<not_specific>
def experiment(name_of_experiment, collect_data=False, datasets=None, model='log_reg', model_kwargs=None, l1=0., l2=0., synthetic_hypers=None, set_T=None, optimizer=rf.MomentumOptimizer, optimizer_kwargs=None, batch_size=200, algo_hyper_wrt_tr_error=False, ...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package. :param name_of_experiment: a name for the experiment. Will be used as root folder for the saver (this is the only positional parameter..) :param collect_data: (default False) whet...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package.
[ "General", "method", "for", "conducting", "various", "simple", "experiments", "(", "on", "MNIST", "dataset", ")", "with", "RFHO", "package", "." ]
def experiment(name_of_experiment, collect_data=False, datasets=None, model='log_reg', model_kwargs=None, l1=0., l2=0., synthetic_hypers=None, set_T=None, optimizer=rf.MomentumOptimizer, optimizer_kwargs=None, batch_size=200, algo_hyper_wrt_tr_error=False, ...
[ "def", "experiment", "(", "name_of_experiment", ",", "collect_data", "=", "False", ",", "datasets", "=", "None", ",", "model", "=", "'log_reg'", ",", "model_kwargs", "=", "None", ",", "l1", "=", "0.", ",", "l2", "=", "0.", ",", "synthetic_hypers", "=", "...
General method for conducting various simple experiments (on MNIST dataset) with RFHO package.
[ "General", "method", "for", "conducting", "various", "simple", "experiments", "(", "on", "MNIST", "dataset", ")", "with", "RFHO", "package", "." ]
[ "\"\"\"\n General method for conducting various simple experiments (on MNIST dataset) with RFHO package.\n\n :param name_of_experiment: a name for the experiment. Will be used as root folder for the saver (this is the only\n positional parameter..)\n :param collect_data: (def...
[ { "param": "name_of_experiment", "type": null }, { "param": "collect_data", "type": null }, { "param": "datasets", "type": null }, { "param": "model", "type": null }, { "param": "model_kwargs", "type": null }, { "param": "l1", "type": null }, {...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "name_of_experiment", "type": null, "docstring": "a name for the experiment. Will be used as root folder for the saver (th...
6ac503a1d17481357ecfa67ed80ea1256260ac4c
lucfra/RFHO
tests/test_hyper_gradients.py
[ "MIT" ]
Python
build_model
<not_specific>
def build_model(augment=0, variable_initializer=(tf.zeros, tf.zeros)): """ Simple model for test purposes on minist :param augment: :param variable_initializer: :return: """ mnist = load_mnist() x = tf.placeholder(tf.float32) y = tf.placeholder(tf.float32) lin_model = Lin...
Simple model for test purposes on minist :param augment: :param variable_initializer: :return:
Simple model for test purposes on minist
[ "Simple", "model", "for", "test", "purposes", "on", "minist" ]
def build_model(augment=0, variable_initializer=(tf.zeros, tf.zeros)): mnist = load_mnist() x = tf.placeholder(tf.float32) y = tf.placeholder(tf.float32) lin_model = LinearModel(x, 28 * 28, 10, active_gen_kwars={'init_w': variable_initializer[0], ...
[ "def", "build_model", "(", "augment", "=", "0", ",", "variable_initializer", "=", "(", "tf", ".", "zeros", ",", "tf", ".", "zeros", ")", ")", ":", "mnist", "=", "load_mnist", "(", ")", "x", "=", "tf", ".", "placeholder", "(", "tf", ".", "float32", ...
Simple model for test purposes on minist
[ "Simple", "model", "for", "test", "purposes", "on", "minist" ]
[ "\"\"\"\n Simple model for test purposes on minist\n \n :param augment: \n :param variable_initializer: \n :return: \n \"\"\"" ]
[ { "param": "augment", "type": null }, { "param": "variable_initializer", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "augment", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, ...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
from_list
<not_specific>
def from_list(list_of_datasets): """ Generates a `Datasets` object from a list. :param list_of_datasets: list containing from one to three dataset :return: """ train, valid, test = None, None, None train = list_of_datasets[0] if len(list_of_datasets) > 3:...
Generates a `Datasets` object from a list. :param list_of_datasets: list containing from one to three dataset :return:
Generates a `Datasets` object from a list.
[ "Generates", "a", "`", "Datasets", "`", "object", "from", "a", "list", "." ]
def from_list(list_of_datasets): train, valid, test = None, None, None train = list_of_datasets[0] if len(list_of_datasets) > 3: print('There are more then 3 Datasets here...') return list_of_datasets if len(list_of_datasets) > 1: test = list_of_datase...
[ "def", "from_list", "(", "list_of_datasets", ")", ":", "train", ",", "valid", ",", "test", "=", "None", ",", "None", ",", "None", "train", "=", "list_of_datasets", "[", "0", "]", "if", "len", "(", "list_of_datasets", ")", ">", "3", ":", "print", "(", ...
Generates a `Datasets` object from a list.
[ "Generates", "a", "`", "Datasets", "`", "object", "from", "a", "list", "." ]
[ "\"\"\"\n Generates a `Datasets` object from a list.\n\n :param list_of_datasets: list containing from one to three dataset\n :return:\n \"\"\"" ]
[ { "param": "list_of_datasets", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "list_of_datasets", "type": null, "docstring": "list containing from one to three dataset", "docstring_tokens": [ ...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
stack
<not_specific>
def stack(*datasets_s): """ Stack some datasets calling stack for each dataset. :param datasets_s: :return: a new dataset """ return Datasets.from_list([Dataset.stack(*[d[k] for d in datasets_s if d[k] is not None]) for k in ra...
Stack some datasets calling stack for each dataset. :param datasets_s: :return: a new dataset
Stack some datasets calling stack for each dataset.
[ "Stack", "some", "datasets", "calling", "stack", "for", "each", "dataset", "." ]
def stack(*datasets_s): return Datasets.from_list([Dataset.stack(*[d[k] for d in datasets_s if d[k] is not None]) for k in range(3)])
[ "def", "stack", "(", "*", "datasets_s", ")", ":", "return", "Datasets", ".", "from_list", "(", "[", "Dataset", ".", "stack", "(", "*", "[", "d", "[", "k", "]", "for", "d", "in", "datasets_s", "if", "d", "[", "k", "]", "is", "not", "None", "]", ...
Stack some datasets calling stack for each dataset.
[ "Stack", "some", "datasets", "calling", "stack", "for", "each", "dataset", "." ]
[ "\"\"\"\n Stack some datasets calling stack for each dataset.\n \n :param datasets_s: \n :return: a new dataset\n \"\"\"" ]
[]
{ "returns": [ { "docstring": "a new dataset", "docstring_tokens": [ "a", "new", "dataset" ], "type": null } ], "raises": [], "params": [], "outlier_params": [ { "identifier": "datasets_s", "type": null, "docstring": null, "do...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
create_supplier
<not_specific>
def create_supplier(self, x, y, other_feeds=None): """ Return a standard feed dictionary for this dataset. :param x: placeholder for data :param y: placeholder for target :param other_feeds: optional other feeds :return: a callable. """ if not other_feeds...
Return a standard feed dictionary for this dataset. :param x: placeholder for data :param y: placeholder for target :param other_feeds: optional other feeds :return: a callable.
Return a standard feed dictionary for this dataset.
[ "Return", "a", "standard", "feed", "dictionary", "for", "this", "dataset", "." ]
def create_supplier(self, x, y, other_feeds=None): if not other_feeds: other_feeds = {} def _supplier(step=None): if isinstance(self.data, WindowedData): data = self.data.generate_all() return {**{x: self.data, y: self.target}, **other_feeds} return _suppl...
[ "def", "create_supplier", "(", "self", ",", "x", ",", "y", ",", "other_feeds", "=", "None", ")", ":", "if", "not", "other_feeds", ":", "other_feeds", "=", "{", "}", "def", "_supplier", "(", "step", "=", "None", ")", ":", "\"\"\"\n\n :param step:...
Return a standard feed dictionary for this dataset.
[ "Return", "a", "standard", "feed", "dictionary", "for", "this", "dataset", "." ]
[ "\"\"\"\n Return a standard feed dictionary for this dataset.\n\n :param x: placeholder for data\n :param y: placeholder for target\n :param other_feeds: optional other feeds\n :return: a callable.\n \"\"\"", "# noinspection PyUnusedLocal", "\"\"\"\n\n :param...
[ { "param": "self", "type": null }, { "param": "x", "type": null }, { "param": "y", "type": null }, { "param": "other_feeds", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
stack
<not_specific>
def stack(*datasets): """ Assuming that the datasets have same structure, stucks data and targets :param datasets: :return: stacked dataset """ return Dataset(data=vstack([d.data for d in datasets]), target=stack_or_concat([d.target for d ...
Assuming that the datasets have same structure, stucks data and targets :param datasets: :return: stacked dataset
Assuming that the datasets have same structure, stucks data and targets
[ "Assuming", "that", "the", "datasets", "have", "same", "structure", "stucks", "data", "and", "targets" ]
def stack(*datasets): return Dataset(data=vstack([d.data for d in datasets]), target=stack_or_concat([d.target for d in datasets]), sample_info=stack_or_concat([d.sample_info for d in datasets]), info={k: [d.info.get(k, None) for d in datasets...
[ "def", "stack", "(", "*", "datasets", ")", ":", "return", "Dataset", "(", "data", "=", "vstack", "(", "[", "d", ".", "data", "for", "d", "in", "datasets", "]", ")", ",", "target", "=", "stack_or_concat", "(", "[", "d", ".", "target", "for", "d", ...
Assuming that the datasets have same structure, stucks data and targets
[ "Assuming", "that", "the", "datasets", "have", "same", "structure", "stucks", "data", "and", "targets" ]
[ "\"\"\"\n Assuming that the datasets have same structure, stucks data and targets\n \n :param datasets: \n :return: stacked dataset\n \"\"\"" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [ { "identifier": "datasets", "type": null, "docstring": null, "docstring_tokens": [ "None" ], ...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
load_iris
<not_specific>
def load_iris(partitions_proportions=None, classes=3): """Loads Iris dataset divided as training and test set (by default)""" training_set = tf.contrib.learn.datasets.base.load_csv_with_header( filename=IRIS_TRAINING, target_dtype=np.int, features_dtype=np.float32) test_set = tf.cont...
Loads Iris dataset divided as training and test set (by default)
Loads Iris dataset divided as training and test set (by default)
[ "Loads", "Iris", "dataset", "divided", "as", "training", "and", "test", "set", "(", "by", "default", ")" ]
def load_iris(partitions_proportions=None, classes=3): training_set = tf.contrib.learn.datasets.base.load_csv_with_header( filename=IRIS_TRAINING, target_dtype=np.int, features_dtype=np.float32) test_set = tf.contrib.learn.datasets.base.load_csv_with_header( filename=IRIS_TEST, ...
[ "def", "load_iris", "(", "partitions_proportions", "=", "None", ",", "classes", "=", "3", ")", ":", "training_set", "=", "tf", ".", "contrib", ".", "learn", ".", "datasets", ".", "base", ".", "load_csv_with_header", "(", "filename", "=", "IRIS_TRAINING", ","...
Loads Iris dataset divided as training and test set (by default)
[ "Loads", "Iris", "dataset", "divided", "as", "training", "and", "test", "set", "(", "by", "default", ")" ]
[ "\"\"\"Loads Iris dataset divided as training and test set (by default)\"\"\"", "# noinspection PyUnusedLocal", "# discard first class", "# noinspection PyUnusedLocal" ]
[ { "param": "partitions_proportions", "type": null }, { "param": "classes", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "partitions_proportions", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "classes", "type": null, "docstring": null, ...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
redivide_data
<not_specific>
def redivide_data(datasets, partition_proportions=None, shuffle=False, filters=None, maps=None, balance_classes=False): """ Function that redivides datasets. Can be use also to shuffle or filter or map examples. :param datasets: original datasets, instances of class Dataset (works with get_data and get_tar...
Function that redivides datasets. Can be use also to shuffle or filter or map examples. :param datasets: original datasets, instances of class Dataset (works with get_data and get_targets for compatibility with mnist datasets :param partition_proportions: (optional, default None) list of fractions th...
Function that redivides datasets. Can be use also to shuffle or filter or map examples.
[ "Function", "that", "redivides", "datasets", ".", "Can", "be", "use", "also", "to", "shuffle", "or", "filter", "or", "map", "examples", "." ]
def redivide_data(datasets, partition_proportions=None, shuffle=False, filters=None, maps=None, balance_classes=False): all_data = vstack([get_data(d) for d in datasets]) all_labels = stack_or_concat([get_targets(d) for d in datasets]) all_infos = np.concatenate([d.sample_info for d in datasets]) N = al...
[ "def", "redivide_data", "(", "datasets", ",", "partition_proportions", "=", "None", ",", "shuffle", "=", "False", ",", "filters", "=", "None", ",", "maps", "=", "None", ",", "balance_classes", "=", "False", ")", ":", "all_data", "=", "vstack", "(", "[", ...
Function that redivides datasets.
[ "Function", "that", "redivides", "datasets", "." ]
[ "\"\"\"\n Function that redivides datasets. Can be use also to shuffle or filter or map examples.\n\n :param datasets: original datasets, instances of class Dataset (works with get_data and get_targets for\n compatibility with mnist datasets\n :param partition_proportions: (optional, default None) list...
[ { "param": "datasets", "type": null }, { "param": "partition_proportions", "type": null }, { "param": "shuffle", "type": null }, { "param": "filters", "type": null }, { "param": "maps", "type": null }, { "param": "balance_classes", "type": null }...
{ "returns": [ { "docstring": "a list of datasets of length equal to the (possibly augmented) partition_proportion", "docstring_tokens": [ "a", "list", "of", "datasets", "of", "length", "equal", "to", "the", "(", "...
116779e92d594a64e2a0dcefe6ae0845b7e6cf66
lucfra/RFHO
rfho/datasets.py
[ "MIT" ]
Python
generate_visiting_scheme
<not_specific>
def generate_visiting_scheme(self): """ Generates and stores example visiting scheme, as a numpy array of integers. :return: self """ def all_indices_shuffled(): _res = list(range(self.dataset.num_examples)) np.random.shuffle(_res) return _re...
Generates and stores example visiting scheme, as a numpy array of integers. :return: self
Generates and stores example visiting scheme, as a numpy array of integers.
[ "Generates", "and", "stores", "example", "visiting", "scheme", "as", "a", "numpy", "array", "of", "integers", "." ]
def generate_visiting_scheme(self): def all_indices_shuffled(): _res = list(range(self.dataset.num_examples)) np.random.shuffle(_res) return _res self.training_schedule = np.concatenate([all_indices_shuffled() for _ in ...
[ "def", "generate_visiting_scheme", "(", "self", ")", ":", "def", "all_indices_shuffled", "(", ")", ":", "_res", "=", "list", "(", "range", "(", "self", ".", "dataset", ".", "num_examples", ")", ")", "np", ".", "random", ".", "shuffle", "(", "_res", ")", ...
Generates and stores example visiting scheme, as a numpy array of integers.
[ "Generates", "and", "stores", "example", "visiting", "scheme", "as", "a", "numpy", "array", "of", "integers", "." ]
[ "\"\"\"\n Generates and stores example visiting scheme, as a numpy array of integers.\n\n :return: self\n \"\"\"", "# noinspection PyUnusedLocal" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
generate_setting_dict
<not_specific>
def generate_setting_dict(local_variables, excluded=None): """ Generates a dictionary of (name, values) of local variables (typically obtained by vars()) that can be saved at the beginning of the experiment. Furthermore, if an object obj in local_variables implements the function setting(), it saves the...
Generates a dictionary of (name, values) of local variables (typically obtained by vars()) that can be saved at the beginning of the experiment. Furthermore, if an object obj in local_variables implements the function setting(), it saves the result of obj.setting() as value in the dictionary. :param l...
Generates a dictionary of (name, values) of local variables (typically obtained by vars()) that can be saved at the beginning of the experiment. Furthermore, if an object obj in local_variables implements the function setting(), it saves the result of obj.setting() as value in the dictionary.
[ "Generates", "a", "dictionary", "of", "(", "name", "values", ")", "of", "local", "variables", "(", "typically", "obtained", "by", "vars", "()", ")", "that", "can", "be", "saved", "at", "the", "beginning", "of", "the", "experiment", ".", "Furthermore", "if"...
def generate_setting_dict(local_variables, excluded=None): excluded = as_list(excluded) or [] setting_dict = {k: v.setting() if hasattr(v, 'setting') else v for k, v in local_variables.items() if v not in excluded} import datetime setting_dict['datetime'] = str(datetime.datetime.now(...
[ "def", "generate_setting_dict", "(", "local_variables", ",", "excluded", "=", "None", ")", ":", "excluded", "=", "as_list", "(", "excluded", ")", "or", "[", "]", "setting_dict", "=", "{", "k", ":", "v", ".", "setting", "(", ")", "if", "hasattr", "(", "...
Generates a dictionary of (name, values) of local variables (typically obtained by vars()) that can be saved at the beginning of the experiment.
[ "Generates", "a", "dictionary", "of", "(", "name", "values", ")", "of", "local", "variables", "(", "typically", "obtained", "by", "vars", "()", ")", "that", "can", "be", "saved", "at", "the", "beginning", "of", "the", "experiment", "." ]
[ "\"\"\"\n Generates a dictionary of (name, values) of local variables (typically obtained by vars()) that\n can be saved at the beginning of the experiment. Furthermore, if an object obj in local_variables implements the\n function setting(), it saves the result of obj.setting() as value in the dictionary....
[ { "param": "local_variables", "type": null }, { "param": "excluded", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "local_variables", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": n...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
add_items
<not_specific>
def add_items(self, *items): """ Adds internally items to this saver :param items: :return: """ processed_items = Saver.process_items(*items) self._processed_items += processed_items return [pt[0] for pt in processed_items]
Adds internally items to this saver :param items: :return:
Adds internally items to this saver
[ "Adds", "internally", "items", "to", "this", "saver" ]
def add_items(self, *items): processed_items = Saver.process_items(*items) self._processed_items += processed_items return [pt[0] for pt in processed_items]
[ "def", "add_items", "(", "self", ",", "*", "items", ")", ":", "processed_items", "=", "Saver", ".", "process_items", "(", "*", "items", ")", "self", ".", "_processed_items", "+=", "processed_items", "return", "[", "pt", "[", "0", "]", "for", "pt", "in", ...
Adds internally items to this saver
[ "Adds", "internally", "items", "to", "this", "saver" ]
[ "\"\"\"\n Adds internally items to this saver\n\n :param items:\n :return:\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
save
<not_specific>
def save(self, step=None, session=None, append_string="", do_print=None, collect_data=None, processed_items=None, _res=None): """ Builds and save a dictionary with the keys and values specified at construction time or by method `add_items` :param processed_items: optional, ...
Builds and save a dictionary with the keys and values specified at construction time or by method `add_items` :param processed_items: optional, processed item list (returned by add_items) if None uses internally stored items :param session: Optional tens...
Builds and save a dictionary with the keys and values specified at construction time or by method `add_items`
[ "Builds", "and", "save", "a", "dictionary", "with", "the", "keys", "and", "values", "specified", "at", "construction", "time", "or", "by", "method", "`", "add_items", "`" ]
def save(self, step=None, session=None, append_string="", do_print=None, collect_data=None, processed_items=None, _res=None): from tensorflow import get_default_session if step is None: self._step += 1 step = self._step if not processed_items: processed_items...
[ "def", "save", "(", "self", ",", "step", "=", "None", ",", "session", "=", "None", ",", "append_string", "=", "\"\"", ",", "do_print", "=", "None", ",", "collect_data", "=", "None", ",", "processed_items", "=", "None", ",", "_res", "=", "None", ")", ...
Builds and save a dictionary with the keys and values specified at construction time or by method `add_items`
[ "Builds", "and", "save", "a", "dictionary", "with", "the", "keys", "and", "values", "specified", "at", "construction", "time", "or", "by", "method", "`", "add_items", "`" ]
[ "\"\"\"\n Builds and save a dictionary with the keys and values specified at construction time or by method\n `add_items`\n\n :param processed_items: optional, processed item list (returned by add_items)\n if None uses internally stored items\n :param sessi...
[ { "param": "self", "type": null }, { "param": "step", "type": null }, { "param": "session", "type": null }, { "param": "append_string", "type": null }, { "param": "do_print", "type": null }, { "param": "collect_data", "type": null }, { "par...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
pack_save_dictionaries
<not_specific>
def pack_save_dictionaries(self, name='all', append_string='', erase_others=True): """ Creates an unique file starting from file created by method `save`. The file contains a dictionary with keys equal to save_dict keys and values list of values form original files. :param name: ...
Creates an unique file starting from file created by method `save`. The file contains a dictionary with keys equal to save_dict keys and values list of values form original files. :param name: :param append_string: :param erase_others: :return: The generated dictionary ...
Creates an unique file starting from file created by method `save`. The file contains a dictionary with keys equal to save_dict keys and values list of values form original files.
[ "Creates", "an", "unique", "file", "starting", "from", "file", "created", "by", "method", "`", "save", "`", ".", "The", "file", "contains", "a", "dictionary", "with", "keys", "equal", "to", "save_dict", "keys", "and", "values", "list", "of", "values", "for...
def pack_save_dictionaries(self, name='all', append_string='', erase_others=True): import glob all_files = sorted(glob.glob(join_paths( self.directory, FOLDER_NAMINGS['OBJ_DIR'], '[0-9]*%s.pkgz' % append_string)), key=os.path.getctime) if len(all_files) == 0: ...
[ "def", "pack_save_dictionaries", "(", "self", ",", "name", "=", "'all'", ",", "append_string", "=", "''", ",", "erase_others", "=", "True", ")", ":", "import", "glob", "all_files", "=", "sorted", "(", "glob", ".", "glob", "(", "join_paths", "(", "self", ...
Creates an unique file starting from file created by method `save`.
[ "Creates", "an", "unique", "file", "starting", "from", "file", "created", "by", "method", "`", "save", "`", "." ]
[ "\"\"\"\n Creates an unique file starting from file created by method `save`.\n The file contains a dictionary with keys equal to save_dict keys and values list of values form original files.\n\n :param name:\n :param append_string:\n :param erase_others:\n :return: The gen...
[ { "param": "self", "type": null }, { "param": "name", "type": null }, { "param": "append_string", "type": null }, { "param": "erase_others", "type": null } ]
{ "returns": [ { "docstring": "The generated dictionary", "docstring_tokens": [ "The", "generated", "dictionary" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
Loader
<not_specific>
def Loader(folder_name): """ utility method for creating a Saver with loading intentions, does not create timer nor append time to name. just give the folder name for the saver :param folder_name: (string or list of strings) either absolute or relative, in which case root_di...
utility method for creating a Saver with loading intentions, does not create timer nor append time to name. just give the folder name for the saver :param folder_name: (string or list of strings) either absolute or relative, in which case root_directory will be used :return...
utility method for creating a Saver with loading intentions, does not create timer nor append time to name. just give the folder name for the saver
[ "utility", "method", "for", "creating", "a", "Saver", "with", "loading", "intentions", "does", "not", "create", "timer", "nor", "append", "time", "to", "name", ".", "just", "give", "the", "folder", "name", "for", "the", "saver" ]
def Loader(folder_name): return Saver(folder_name, append_date_to_name=False, timer=False, collect_data=False)
[ "def", "Loader", "(", "folder_name", ")", ":", "return", "Saver", "(", "folder_name", ",", "append_date_to_name", "=", "False", ",", "timer", "=", "False", ",", "collect_data", "=", "False", ")" ]
utility method for creating a Saver with loading intentions, does not create timer nor append time to name.
[ "utility", "method", "for", "creating", "a", "Saver", "with", "loading", "intentions", "does", "not", "create", "timer", "nor", "append", "time", "to", "name", "." ]
[ "\"\"\"\n utility method for creating a Saver with loading intentions,\n does not create timer nor append time to name. just give the folder name\n for the saver\n\n :param folder_name: (string or list of strings)\n either absolute or relative, in which case root_directory will be...
[ { "param": "folder_name", "type": null } ]
{ "returns": [ { "docstring": "a `Saver` object", "docstring_tokens": [ "a", "`", "Saver", "`", "object" ], "type": null } ], "raises": [], "params": [ { "identifier": "folder_name", "type": null, "docstring": "(string...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
direct
<not_specific>
def direct(*items): """ Everything passed in items is passed directly to `Saver. :param items: :return: """ # noinspection PyUnusedLocal def _call(*args, **kwargs): return items return _call
Everything passed in items is passed directly to `Saver. :param items: :return:
Everything passed in items is passed directly to `Saver.
[ "Everything", "passed", "in", "items", "is", "passed", "directly", "to", "`", "Saver", "." ]
def direct(*items): def _call(*args, **kwargs): return items return _call
[ "def", "direct", "(", "*", "items", ")", ":", "def", "_call", "(", "*", "args", ",", "**", "kwargs", ")", ":", "return", "items", "return", "_call" ]
Everything passed in items is passed directly to `Saver.
[ "Everything", "passed", "in", "items", "is", "passed", "directly", "to", "`", "Saver", "." ]
[ "\"\"\"\n Everything passed in items is passed directly to `Saver.\n\n :param items:\n :return:\n \"\"\"", "# noinspection PyUnusedLocal" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [ { "identifier": "items", "type": null, "docstring": null, "docstring_tokens": [ "None" ], ...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
norms_of_d_dynamics_d_hypers
<not_specific>
def norms_of_d_dynamics_d_hypers(fd=None): """ In `ForwardHG` records the norm of the partial derivatives of the dynamics w.r.t. the hyperparameters. :param fd: :return: """ if fd is None: fd = lambda stp, rs: rs def _call(*args, **kwargs): hg = args...
In `ForwardHG` records the norm of the partial derivatives of the dynamics w.r.t. the hyperparameters. :param fd: :return:
In `ForwardHG` records the norm of the partial derivatives of the dynamics w.r.t. the hyperparameters.
[ "In", "`", "ForwardHG", "`", "records", "the", "norm", "of", "the", "partial", "derivatives", "of", "the", "dynamics", "w", ".", "r", ".", "t", ".", "the", "hyperparameters", "." ]
def norms_of_d_dynamics_d_hypers(fd=None): if fd is None: fd = lambda stp, rs: rs def _call(*args, **kwargs): hg = args[0] if isinstance(hg, rf.HyperOptimizer): hg = hg.hyper_gradients assert isinstance(hg, rf.ForwardHG) _rs = Records.ten...
[ "def", "norms_of_d_dynamics_d_hypers", "(", "fd", "=", "None", ")", ":", "if", "fd", "is", "None", ":", "fd", "=", "lambda", "stp", ",", "rs", ":", "rs", "def", "_call", "(", "*", "args", ",", "**", "kwargs", ")", ":", "hg", "=", "args", "[", "0"...
In `ForwardHG` records the norm of the partial derivatives of the dynamics w.r.t.
[ "In", "`", "ForwardHG", "`", "records", "the", "norm", "of", "the", "partial", "derivatives", "of", "the", "dynamics", "w", ".", "r", ".", "t", "." ]
[ "\"\"\"\n In `ForwardHG` records the norm of the partial derivatives of the dynamics w.r.t. the hyperparameters.\n\n :param fd:\n :return:\n \"\"\"", "# guess most common case" ]
[ { "param": "fd", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "fd", "type": null, "docstring": null, "docstring_tokens": [ "None" ], "default": null, "i...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
hyperparameters
<not_specific>
def hyperparameters(): """ Simple one! record all hyperparameter values, assuming the usage of `HyperOptimizer` :return: a function """ # noinspection PyUnusedLocal def _call(*args, **kwargs): hyper_optimizer = args[0] assert isinstance(hyper_opt...
Simple one! record all hyperparameter values, assuming the usage of `HyperOptimizer` :return: a function
Simple one. record all hyperparameter values, assuming the usage of `HyperOptimizer`
[ "Simple", "one", ".", "record", "all", "hyperparameter", "values", "assuming", "the", "usage", "of", "`", "HyperOptimizer", "`" ]
def hyperparameters(): def _call(*args, **kwargs): hyper_optimizer = args[0] assert isinstance(hyper_optimizer, rf.HyperOptimizer) return rf.flatten_list( [rf.simple_name(hyp), hyp] for hyp in hyper_optimizer.hyper_list) return _call
[ "def", "hyperparameters", "(", ")", ":", "def", "_call", "(", "*", "args", ",", "**", "kwargs", ")", ":", "hyper_optimizer", "=", "args", "[", "0", "]", "assert", "isinstance", "(", "hyper_optimizer", ",", "rf", ".", "HyperOptimizer", ")", "return", "rf"...
Simple one!
[ "Simple", "one!" ]
[ "\"\"\"\n Simple one! record all hyperparameter values, assuming the usage of `HyperOptimizer`\n\n :return: a function\n \"\"\"", "# noinspection PyUnusedLocal" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
hypergradients
<not_specific>
def hypergradients(): """ Record all hypergradient values, assuming the usage of `HyperOptimizer` :return: """ # noinspection PyUnusedLocal def _call(*args, **kwargs): hyper_optimizer = args[0] assert isinstance(hyper_optimizer, rf.HyperOptimizer...
Record all hypergradient values, assuming the usage of `HyperOptimizer` :return:
Record all hypergradient values, assuming the usage of `HyperOptimizer`
[ "Record", "all", "hypergradient", "values", "assuming", "the", "usage", "of", "`", "HyperOptimizer", "`" ]
def hypergradients(): def _call(*args, **kwargs): hyper_optimizer = args[0] assert isinstance(hyper_optimizer, rf.HyperOptimizer) return rf.flatten_list( ['grad::' + rf.simple_name(hyp), hyper_optimizer.hyper_gradients.hyper_gradients_dict[hyp]] ...
[ "def", "hypergradients", "(", ")", ":", "def", "_call", "(", "*", "args", ",", "**", "kwargs", ")", ":", "hyper_optimizer", "=", "args", "[", "0", "]", "assert", "isinstance", "(", "hyper_optimizer", ",", "rf", ".", "HyperOptimizer", ")", "return", "rf",...
Record all hypergradient values, assuming the usage of `HyperOptimizer`
[ "Record", "all", "hypergradient", "values", "assuming", "the", "usage", "of", "`", "HyperOptimizer", "`" ]
[ "\"\"\"\n Record all hypergradient values, assuming the usage of `HyperOptimizer`\n\n :return:\n \"\"\"", "# noinspection PyUnusedLocal" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [], "others": [] }
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
tensors
<not_specific>
def tensors(*tensors, key=None, scope=None, name_contains=None, rec_name='', op=tf.identity, fd=None, condition=True): """ Little more difficult... attempts to record tensor named name :param name_contains: record all tensors which name contains this string. Can ...
Little more difficult... attempts to record tensor named name :param name_contains: record all tensors which name contains this string. Can be a list. :type condition: bool | function :param condition: optional condition for triggering the saving of tensors, can have different ...
Little more difficult... attempts to record tensor named name
[ "Little", "more", "difficult", "...", "attempts", "to", "record", "tensor", "named", "name" ]
def tensors(*tensors, key=None, scope=None, name_contains=None, rec_name='', op=tf.identity, fd=None, condition=True): if rec_name: rec_name += '::' def _call(*args, **_kwargs): if tensors: _tensors = [tf.get_default_graph().get_tensor_by_nam...
[ "def", "tensors", "(", "*", "tensors", ",", "key", "=", "None", ",", "scope", "=", "None", ",", "name_contains", "=", "None", ",", "rec_name", "=", "''", ",", "op", "=", "tf", ".", "identity", ",", "fd", "=", "None", ",", "condition", "=", "True", ...
Little more difficult... attempts to record tensor named name
[ "Little", "more", "difficult", "...", "attempts", "to", "record", "tensor", "named", "name" ]
[ "\"\"\"\n Little more difficult... attempts to record tensor named name\n\n :param name_contains: record all tensors which name contains this string. Can be a list.\n :type condition: bool | function\n :param condition: optional condition for triggering the saving of tensors, can have di...
[ { "param": "key", "type": null }, { "param": "scope", "type": null }, { "param": "name_contains", "type": null }, { "param": "rec_name", "type": null }, { "param": "op", "type": null }, { "param": "fd", "type": null }, { "param": "condition...
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "key", "type": null, "docstring": "to record collections", "docstring_tokens": [ "to", "record", ...
0f10d15363a141401cde23b1ebef74e9ec1c8736
lucfra/RFHO
rfho/save_and_load.py
[ "MIT" ]
Python
model
null
def model(): # TODO discuss with others to see what's best way to save models... """ Should save the model(s) in a useful way.. :return: """ raise NotImplemented()
Should save the model(s) in a useful way.. :return:
Should save the model(s) in a useful way
[ "Should", "save", "the", "model", "(", "s", ")", "in", "a", "useful", "way" ]
def model(): raise NotImplemented()
[ "def", "model", "(", ")", ":", "raise", "NotImplemented", "(", ")" ]
Should save the model(s) in a useful way..
[ "Should", "save", "the", "model", "(", "s", ")", "in", "a", "useful", "way", ".." ]
[ "# TODO discuss with others to see what's best way to save models...", "\"\"\"\n Should save the model(s) in a useful way..\n\n :return:\n \"\"\"" ]
[]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [], "outlier_params": [], "others": [] }