file
stringlengths
8
116
function
stringlengths
2
72
version_data
listlengths
2
2
diff_code
stringlengths
87
17.4k
diff_docstring
stringlengths
31
12k
whitespace_only_code
bool
1 class
whitespace_only_docstring
bool
1 class
file_path
stringlengths
9
116
filename
stringlengths
5
52
project
stringclasses
100 values
owner
stringclasses
96 values
theano_tensor_blas.py
ldflags
[ { "version": "v263", "docstring_lines": { "start_line": 534, "end_line": 540 }, "code_lines": { "start_line": 540, "end_line": 586 }, "commit_date_time": "2015-06-22 20:22:45", "commit_sha": "016d66b314ad02c58041cfc66d6054c7509cf7b4", "commit_message": "Missin...
def ldflags(libs=True, flags=False, libs_dir=False, include_dir=False): + ldflags_str = theano.config.blas.ldflags + return _ldflags(ldflags_str=ldflags_str, + libs=libs, + flags=flags, + libs_dir=libs_dir, + include...
+ Extract a list of compilation flags from config.blas.ldflags. - Return a list of libraries against which an Op's object file should be - linked to benefit from a BLAS implementation. - Default: ['blas'], but configuration variable config.blas.ldflags - overrides this. + Depending on the options, di...
false
false
theano/tensor/blas.py
blas.py
Theano
Theano
conans_model_settings.py
Settings.dumps
[ { "version": "v31", "docstring_lines": { "start_line": 295, "end_line": 299 }, "code_lines": { "start_line": 299, "end_line": 301 }, "commit_date_time": "2022-04-25 11:41:56", "commit_sha": "674543dec8bfbc0f5e6a36903c80e94bcb54d9cc", "commit_message": "Use cla...
def dumps(self): - return "\n".join(["%s=%s" % (field, value) + result = [] - for (field, value) in self.values_list]) ? ------------------ ^^ -- ^^ + for (name, value) in self.values_list: ? ...
- produces a text string with lines containine a flattened version: ? ^ + produces a text string with lines containing a flattened version: ? ^ compiler.arch = XX compiler.arch.speed = YY
false
false
conans/model/settings.py
settings.py
conan
conan-io
homeassistant_components_simplisafe___init__.py
SimpliSafeEntity._async_internal_update_from_websocket_event
[ { "version": "v39", "docstring_lines": { "start_line": 707, "end_line": 712 }, "code_lines": { "start_line": 712, "end_line": 714 }, "commit_date_time": "2020-04-05 08:33:07", "commit_sha": "7653dc947ad7453329d73a07cb552c4e552dc048", "commit_message": "Enable ...
def _async_internal_update_from_websocket_event(self, event): - if event.event_type == EVENT_CONNECTION_LOST: self._online = False elif event.event_type == EVENT_CONNECTION_RESTORED: self._online = True # It's uncertain whether SimpliSaf...
+ Perform internal websocket handling prior to handing off. - Check for connection events and set offline appropriately. - - Should not be called directly.
false
false
homeassistant/components/simplisafe/__init__.py
__init__.py
core
home-assistant
chainer_
dilated_convolution_2d
[ { "version": "v24", "docstring_lines": { "start_line": 343, "end_line": 406 }, "code_lines": { "start_line": 406, "end_line": 412 }, "commit_date_time": "2017-05-08 23:58:26", "commit_sha": "5e6549bc581849d2b3f4af02080d3d769f3aebd8", "commit_message": "flake8"...
def dilated_convolution_2d(x, W, b=None, stride=1, pad=0, dilate=1, - use_cudnn=True, cover_all=False): ? ---------------- + cover_all=False): - func = DilatedConvolution2DFunction( - stride, pad, dilate, use...
Two-dimensional dilated convolution function. This is an implementation of two-dimensional dilated convolution in ConvNets. It takes three variables: the input image ``x``, the filter weight ``W``, and the bias vector ``b``. Notation: here is a notation for dimensionalities. ...
false
false
chainer/functions/connection/dilated_convolution_2d.py
dilated_convolution_2d.py
chainer
chainer
chainer_
deconvolution_2d
[ { "version": "v124", "docstring_lines": { "start_line": 302, "end_line": 407 }, "code_lines": { "start_line": 407, "end_line": 422 }, "commit_date_time": "2018-03-26 01:41:53", "commit_sha": "bebe081af4cc5f937187ae6ca8d7744e0db080e3", "commit_message": "Suppor...
- def deconvolution_2d(x, W, b=None, stride=1, pad=0, outsize=None, groups=1, ? ---- ^^^ + def deconvolution_2d(x, W, b=None, stride=1, pad=0, outsize=None, **kwargs): ? ++++++ ^^ - ...
- deconvolution_2d(x, W, b=None, stride=1, pad=0, outsize=None) + deconvolution_2d(x, W, b=None, stride=1, pad=0, outsize=None, *, groups=1) ? +++++++++++++ Two dimensional deconvolution function. This is an implementation of two-dimensional...
false
false
chainer/functions/connection/deconvolution_2d.py
deconvolution_2d.py
chainer
chainer
chainer_
softmax_cross_entropy
[ { "version": "v67", "docstring_lines": { "start_line": 179, "end_line": 207 }, "code_lines": { "start_line": 207, "end_line": 208 }, "commit_date_time": "2016-03-28 02:16:43", "commit_sha": "8e83df8cedd0644ab3cdda0cc26a42a3e0d432a9", "commit_message": "Flake8"...
def softmax_cross_entropy( - x, t, use_cudnn=True, normalize=True, store_forward=True): ? ^ -------- + x, t, use_cudnn=True, normalize=True, cache_score=True): ? ++++++ ^ - return Soft...
Computes cross entropy loss for pre-softmax activations. Args: x (Variable): Variable holding a multidimensional array whose element indicates unnormalized log probability: the first axis of the variable represents the number of samples, and the second axis ...
false
false
chainer/functions/loss/softmax_cross_entropy.py
softmax_cross_entropy.py
chainer
chainer
chainer_
roi_average_align_2d
[ { "version": "v17", "docstring_lines": { "start_line": 531, "end_line": 563 }, "code_lines": { "start_line": 563, "end_line": 565 }, "commit_date_time": "2018-09-19 04:33:55", "commit_sha": "1d49d9d81e58124f4dbda04c697b0de8080390c1", "commit_message": "update ...
def roi_average_align_2d( - x, rois, roi_indices, outsize, spatial_scale, sampling_ratio=0 ? ^ + x, rois, roi_indices, outsize, spatial_scale, sampling_ratio=None ? ...
Spatial Region of Interest (ROI) average align function. This function acts similarly to :class:`~functions.ROIPooling2D`, but it computes average of input spatial patch with bilinear interpolation for each channel with the region of interest. Args: x (~chainer.Variable): Input...
false
false
chainer/functions/pooling/roi_average_align_2d.py
roi_average_align_2d.py
chainer
chainer
chainer_
roi_max_align_2d
[ { "version": "v21", "docstring_lines": { "start_line": 443, "end_line": 473 }, "code_lines": { "start_line": 473, "end_line": 475 }, "commit_date_time": "2018-09-20 09:40:21", "commit_sha": "5af0f7bc256c521036acba010fb5ee1dec6ae6e2", "commit_message": "support...
def roi_max_align_2d( - x, rois, roi_indices, outsize, spatial_scale, sampling_ratio=0 ? ^ + x, rois, roi_indices, outsize, spatial_scale, sampling_ratio=None ? ^^...
Spatial Region of Interest (ROI) max align function. This function acts similarly to :class:`~functions.ROIPooling2D`, but it computes the maximum of input spatial patch with bilinear interpolation for each channel with the region of interest. Args: x (~chainer.Variable): Input...
false
false
chainer/functions/pooling/roi_max_align_2d.py
roi_max_align_2d.py
chainer
chainer
chainer_
convolution_2d
[ { "version": "v177", "docstring_lines": { "start_line": 431, "end_line": 563 }, "code_lines": { "start_line": 563, "end_line": 579 }, "commit_date_time": "2018-04-05 07:31:12", "commit_sha": "d78e9d63a44a951c2a1fe760f94e4af9b5789362", "commit_message": "fix do...
def convolution_2d(x, W, b=None, stride=1, pad=0, cover_all=False, **kwargs): # NOQA - argument.check_unexpected_kwargs( + dilate, groups = argument.parse_kwargs( + kwargs, ('dilate', 1), ('groups', 1), - kwargs, deterministic="deterministic argument is not " ? -------...
convolution_2d(x, W, b=None, stride=1, pad=0, cover_all=False, *, dilate=1, groups=1) Two-dimensional convolution function. This is an implementation of two-dimensional convolution in ConvNets. It takes three variables: the input image ``x``, the filter weight ``W``, and the bias vector ...
false
false
chainer/functions/connection/convolution_2d.py
convolution_2d.py
chainer
chainer
chainer_
resize_images
[ { "version": "v28", "docstring_lines": { "start_line": 303, "end_line": 334 }, "code_lines": { "start_line": 334, "end_line": 335 }, "commit_date_time": "2019-08-22 16:38:44", "commit_sha": "e198a77419c30b84e73bd27a3a37457b03d222df", "commit_message": "Make `m...
- def resize_images(x, output_shape, *, mode='bilinear', align_corners=True): ? --- + def resize_images(x, output_shape, mode='bilinear', align_corners=True): return ResizeImages(output_shape, mode, align_corners).apply((x,))[0]
Resize images to the given shape. This function resizes 2D data to :obj:`output_shape`. - Currently, only bilinear interpolation is supported as the sampling method. Notation: here is a notation for dimensionalities. - :math:`n` is the batch size. - :math:`c_I` is the number of th...
false
false
chainer/functions/array/resize_images.py
resize_images.py
chainer
chainer
chainer_
rsqrt
[ { "version": "v24", "docstring_lines": { "start_line": 72, "end_line": 85 }, "code_lines": { "start_line": 85, "end_line": 91 }, "commit_date_time": "2018-10-23 07:58:36", "commit_sha": "ed1081c37e9a76502496f038dd4dbf1455c44c8d", "commit_message": "make type_c...
def rsqrt(x): xp = backend.get_array_module(x) - if xp is numpy: + if xp is numpy or xp is chainerx: return 1.0 / sqrt(x) # CuPy provides `rsqrt` which is faster than `1.0 / sqrt(x)`. return RsqrtGPU().apply((x,))[0]
Computes elementwise reciprocal of square root of input :math:`x_i`. .. math:: y_i = {1 \\over \\sqrt x_i}. Args: - x (~chainer.Variable): Input variable. + x (:class:`~chainer.Variable` or :ref:`ndarray`): Input variable. ? ++++++++ ++++++++++++++...
false
false
chainer/functions/math/sqrt.py
sqrt.py
chainer
chainer
chainer_
DiagEinSum.backward
[ { "version": "v6", "docstring_lines": { "start_line": 106, "end_line": 122 }, "code_lines": { "start_line": 122, "end_line": 142 }, "commit_date_time": "2018-04-12 12:50:04", "commit_sha": "4a896677f27fcba056fbd8c77eb6c38ad7a52b4f", "commit_message": "debuggin...
def backward(self, indices, grad_outputs): inputs = self.get_retained_inputs() g, = grad_outputs fwd_in_subs = self.in_subs.split(',') fwd_out_sub = self.out_sub - ret = [] - for i in indices: - bwd_in_subs = ',...
if self.n_args >= 2: inputs = self.get_retained_inputs() else: + # TODO(kataoka): fix xp = cuda.get_array_module(grad_outputs[0]) - inputs = [xp.zeros(self.input_shape, dtype=grad_outputs[0].dtype)] # TODO(kataoka): f ? ...
false
false
chainer/functions/math/einsum.py
einsum.py
chainer
chainer
chainer_
simplified_dropconnect
[ { "version": "v83", "docstring_lines": { "start_line": 137, "end_line": 191 }, "code_lines": { "start_line": 191, "end_line": 199 }, "commit_date_time": "2017-12-04 05:44:33", "commit_sha": "835b9b54a9d3162c3d35ef07b5ab6116b45a7fe8", "commit_message": "new sty...
def simplified_dropconnect(x, W, b=None, ratio=.5, train=True, mask=None, use_batchwise_mask=True): if not train: ratio = 0 if b is None: + return SimplifiedDropconnect(ratio, mask, use_batchwise_mask)(x, W) - return SimplifiedDropconnec...
Linear unit regularized by simplified dropconnect. Simplified dropconnect drops weight matrix elements randomly with probability ``ratio`` and scales the remaining elements by factor ``1 / (1 - ratio)``. It accepts two or three arguments: an input minibatch ``x``, a weight matrix ``W`...
false
false
chainer/functions/noise/simplified_dropconnect.py
simplified_dropconnect.py
chainer
chainer
chainer_
batch_normalization
[ { "version": "v103", "docstring_lines": { "start_line": 724, "end_line": 744 }, "code_lines": { "start_line": 744, "end_line": 745 }, "commit_date_time": "2018-03-20 12:01:53", "commit_sha": "e1a73336871cb3cef32a1e28adf18939f1dbcf6c", "commit_message": "save s...
def batch_normalization(x, gamma, beta, **kwargs): # NOQA argument.check_unexpected_kwargs( kwargs, train='train argument is not supported anymore. ' 'Use chainer.using_config') - eps, running_mean, running_var, decay = argument.parse_kwargs( + eps, running_mean,...
batch_normalization(x, gamma, beta, eps=2e-5, running_mean=None, running_var=None, decay=0.9) Batch normalization function. It takes the input variable ``x`` and two parameter variables ``gamma`` and ``beta``. The parameter variables must both have the same dimensionality, which is refer...
false
false
chainer/functions/normalization/batch_normalization.py
batch_normalization.py
chainer
chainer
chainer_
fixed_batch_normalization
[ { "version": "v47", "docstring_lines": { "start_line": 138, "end_line": 158 }, "code_lines": { "start_line": 158, "end_line": 159 }, "commit_date_time": "2016-07-11 01:52:03", "commit_sha": "a7496fd4b85057bfc116e1e3915830b1bd4f9806", "commit_message": "Fix che...
- def fixed_batch_normalization(x, gamma, beta, mean, var, eps=1e-5): ? ^ + def fixed_batch_normalization(x, gamma, beta, fixed_mean, fixed_var, eps=2e-5): ? ++++++ ++++++ ^ - r...
Batch normalization function with fixed statistics. This is a variant of batch normalization, where the mean and variance - statistics are given by the caller as variables. This is used on testing ? ^ - ^^ ---------------- + statistics are given b...
false
false
chainer/functions/normalization/batch_normalization.py
batch_normalization.py
chainer
chainer
chainer_
batch_renormalization
[ { "version": "v51", "docstring_lines": { "start_line": 167, "end_line": 193 }, "code_lines": { "start_line": 193, "end_line": 197 }, "commit_date_time": "2019-06-05 11:43:39", "commit_sha": "60aa83e30b1c4103c6665363680a0d1d0c650ca4", "commit_message": "Explain...
def batch_renormalization(x, gamma, beta, rmax, dmax, eps=2e-5, running_mean=None, running_var=None, decay=0.9, update_statistics=False): + if running_mean is None: + raise TypeError('running_mean is required') + if running_var i...
Batch renormalization function. This is an extension of batch normalization, which ensures that the training and inference models generate the same outputs that depend on individual examples rather than the entire minibatch. .. note:: + This function does not perform in-place ...
false
false
chainer/functions/normalization/batch_renormalization.py
batch_renormalization.py
chainer
chainer
chainer_
_parse_einsum_input
[ { "version": "v9", "docstring_lines": { "start_line": 165, "end_line": 191 }, "code_lines": { "start_line": 191, "end_line": 332 }, "commit_date_time": "2018-04-13 09:30:24", "commit_sha": "ef55382ccb69c4daf54b551ceccf304fa76843aa", "commit_message": "wip: bro...
def _parse_einsum_input(operands): if len(operands) == 0: raise ValueError("No input operands") if isinstance(operands[0], str): subscripts = operands[0].replace(" ", "") operands = operands[1:] # Ensure all characters are valid for ...
Parses einsum operands. This function is based on `numpy.core.einsumfunc._parse_einsum_input` function in NumPy 1.14. Returns ------- input_strings : str Parsed input strings output_string : str Parsed output string operands : list of array_like ...
false
false
chainer/functions/math/einsum.py
einsum.py
chainer
chainer
chainer_
ifft
[ { "version": "v3", "docstring_lines": { "start_line": 54, "end_line": 65 }, "code_lines": { "start_line": 65, "end_line": 66 }, "commit_date_time": "2018-02-22 07:43:36", "commit_sha": "2922263f4e17fcae1afdf4eb9ac760dd7f26b663", "commit_message": "Fix typo", ...
- def ifft(real, imag): + def ifft(x): + real, imag = x return FFT('ifft').apply((real, imag))
Inverse fast Fourier transform. Args: - real (chainer.Variable): Real part of the input. - imag (chainer.Variable): Imaginary part of the input. + x (tuple): ``(real, imag)`` where ``real`` is a + :class:`~chainer.Variable` storing the real part and + ``imag`` ...
false
false
chainer/functions/math/fft.py
fft.py
chainer
chainer
chainer_
broadcast_to
[ { "version": "v38", "docstring_lines": { "start_line": 107, "end_line": 132 }, "code_lines": { "start_line": 132, "end_line": 141 }, "commit_date_time": "2018-10-02 05:39:56", "commit_sha": "34e1036549334791b68f2304a097d7b1a48f20c6", "commit_message": "flake8"...
def broadcast_to(x, shape): if x.shape == shape: return chainer.as_variable(x) - if backend.get_array_module(x) is chainerx: - return function._chainerx_op( - lambda a: chainerx.broadcast_to(a, shape), x) - y, = BroadcastTo(shape).apply((x,)) re...
Broadcast a given variable to a given shape. Args: x (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \ :class:`cupy.ndarray`): Input variable be broadcasted. A \ :math:`(s_1, s_2, ..., s_N)`-shaped float array. shape (tuple): Tuple of :class:...
false
false
chainer/functions/array/broadcast.py
broadcast.py
chainer
chainer
chainer_
permutate
[ { "version": "v9", "docstring_lines": { "start_line": 85, "end_line": 104 }, "code_lines": { "start_line": 104, "end_line": 105 }, "commit_date_time": "2017-04-24 05:43:18", "commit_sha": "e0ff40d05e161da1ba132c7cbd50b7bbe7aeed24", "commit_message": "Release i...
def permutate(x, indices, axis=0, inv=False): + return Permutate(axis=axis, inv=inv)(x, indices)
Permutates a given variable along an axis. This function permutate ``x`` with given ``indices``. That means ``y[i] = x[indices[i]]`` for all ``i``. Note that this result is same as ``y = x.take(indices)``. ``indices`` must be a permutation of ``[0, 1, ..., len(x) - 1]``. When ``inv...
false
false
chainer/functions/array/permutate.py
permutate.py
chainer
chainer
chainer_
unpooling_1d
[ { "version": "v10", "docstring_lines": { "start_line": 168, "end_line": 203 }, "code_lines": { "start_line": 203, "end_line": 204 }, "commit_date_time": "2017-12-18 04:50:48", "commit_sha": "15e09edfc85f8c8fde9dd9259576766f9145e4b5", "commit_message": "Add ave...
- def unpooling_1d(x, ksize, stride=None, pad=0, outsize=None, cover_all=True): ? ------------------------------ + def unpooling_1d(x, ksize, stride=None, pad=0): - if outsize is not None and isinstance(outsize, int): - outsize = (outsize,) + ...
Inverse operation of 1-dimensional spatial pooling. .. warning:: This feature is experimental. The interface can change in the future. + .. note:: - This function calls :func:`~functions.unpooling_nd` with - ``ndim = 1``. - This function acts similary to :class:`~functions.De...
false
false
chainer/functions/pooling/unpooling_nd.py
unpooling_nd.py
chainer
chainer
chainer_
squeeze
[ { "version": "v20", "docstring_lines": { "start_line": 69, "end_line": 109 }, "code_lines": { "start_line": 109, "end_line": 114 }, "commit_date_time": "2018-10-02 05:39:56", "commit_sha": "34e1036549334791b68f2304a097d7b1a48f20c6", "commit_message": "flake8",...
def squeeze(x, axis=None): - if backend.get_array_module(x) is chainerx: - return function._chainerx_op(lambda a: a.squeeze(axis), x) - y, = Squeeze(axis).apply((x,)) return y
Remove demensions of size one from the shape of a ndarray. Args: x (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \ :class:`cupy.ndarray`): Input variable. A :math:`(s_1, s_2, ..., s_N)` -shaped float array. axis (None or int or tuple of ints): A subset o...
false
false
chainer/functions/array/squeeze.py
squeeze.py
chainer
chainer
chainer_
hinge
[ { "version": "v15", "docstring_lines": { "start_line": 93, "end_line": 131 }, "code_lines": { "start_line": 131, "end_line": 132 }, "commit_date_time": "2017-04-17 01:05:58", "commit_sha": "1ffbf5e686fa2d28eae62ab99d19c4af90c0be05", "commit_message": "Improve ...
- def hinge(x, t, norm='L1'): + def hinge(x, t, norm='L1', reduce='mean'): ? +++++++++++++++ - return Hinge(norm)(x, t) + return Hinge(norm, reduce)(x, t) ? ++++++++
Computes the hinge loss for a one-of-many classification task. .. math:: L = \\frac{1}{N} \\sum_{n=1}^N \\sum_{k=1}^K \\left[ - \\max(0, 1 - \\delta\\{t_n = k\\} x_{nk}) \\right]^p ? ^ ^ + \\max(0, 1 - \\delta\\{l_n = k\\}...
false
false
chainer/functions/loss/hinge.py
hinge.py
chainer
chainer
chainer_
prelu
[ { "version": "v25", "docstring_lines": { "start_line": 76, "end_line": 105 }, "code_lines": { "start_line": 105, "end_line": 107 }, "commit_date_time": "2017-03-21 05:53:01", "commit_sha": "430c8db604dc52e28fd8d7f00d1bcd62a009a4d1", "commit_message": "Use type...
def prelu(x, W): - return PReLUFunction()(x, W) + return PReLUFunction().apply((x, W))[0] ? +++++++ ++++
Parametric ReLU function. It accepts two arguments: an input ``x`` and a weight array ``W`` and computes the output as :math:`PReLU(x) = \\max(x, W*x)`, where :math:`*` is an elementwise multiplication for each sample in the batch. When the PReLU function is combined with two-dimen...
false
false
chainer/functions/activation/prelu.py
prelu.py
chainer
chainer
chainer_
log_softmax
[ { "version": "v86", "docstring_lines": { "start_line": 138, "end_line": 183 }, "code_lines": { "start_line": 183, "end_line": 188 }, "commit_date_time": "2018-10-02 06:22:08", "commit_sha": "3e17aeeaf1f7e424149469a450eebed1fcddaae5", "commit_message": "flake8"...
def log_softmax(x, axis=1): - if backend.get_array_module(x) is chainerx: - return function._chainerx_op( - lambda a: chainerx.log_softmax(a, axis), x) - return LogSoftmax(axis=axis).apply((x,))[0]
Channel-wise log-softmax function. This function computes its logarithm of softmax along the second axis. Let :math:`c = (c_1, c_2, \\dots, c_D)` be the slice of ``x`` along with the second axis. For each slice :math:`c`, it computes the logarithm of the function :math:`f(c)` defined as ...
false
false
chainer/functions/activation/log_softmax.py
log_softmax.py
chainer
chainer
chainer_
decorrelated_batch_normalization
[ { "version": "v9", "docstring_lines": { "start_line": 277, "end_line": 301 }, "code_lines": { "start_line": 301, "end_line": 306 }, "commit_date_time": "2019-03-06 01:06:36", "commit_sha": "6c4283a18680f163402393540a6f78a51e2c0089", "commit_message": "Update c...
def decorrelated_batch_normalization(x, **kwargs): - # NOQA + groups, eps, running_mean, running_projection, decay = \ argument.parse_kwargs( kwargs, ('groups', 16), ('eps', 2e-5), ('running_mean', None), ('running_projection', None), ('decay', 0.9)) ...
+ decorrelated_batch_normalization(x, groups=16, eps2e-5, + running_mean=None, running_projection=None, decay=0.9) + - Decorrelated batch normalization function. + Decorrelated batch normalization function. ? ++++ It takes the input variable ``x`` and normalizes it using batch statistics to make th...
false
false
chainer/functions/normalization/decorrelated_batch_normalization.py
decorrelated_batch_normalization.py
chainer
chainer
chainer_
matmul
[ { "version": "v87", "docstring_lines": { "start_line": 171, "end_line": 201 }, "code_lines": { "start_line": 201, "end_line": 203 }, "commit_date_time": "2018-09-28 11:23:44", "commit_sha": "fbb47c8769952da4e9aa0ec928df4b3e668aa2fd", "commit_message": "check f...
def matmul(a, b, transa=False, transb=False): + if backend.get_array_module(a, b) is chainerx: + # TODO(sonots): Support transa and transb in ChainerX + # TODO(sonots): Support dtype promotion in ChainerX + # TODO(sonots): Support ndim > 2 in ChainerX + if (not tra...
Computes the matrix multiplication of two arrays. Args: a (Variable): The left operand of the matrix multiplication. If ``a`` and ``b`` are both 1-D arrays, ``matmul`` returns a dot product of vector `a` and vector `b`. If 2-D arrays, ``matmul`` returns mat...
false
false
chainer/functions/math/matmul.py
matmul.py
chainer
chainer
chainer_
transpose_sequence
[ { "version": "v16", "docstring_lines": { "start_line": 89, "end_line": 104 }, "code_lines": { "start_line": 104, "end_line": 107 }, "commit_date_time": "2017-09-18 14:02:24", "commit_sha": "aa14984e6a1e97d48e83f4ab418901b9196d8187", "commit_message": "New styl...
def transpose_sequence(xs): - if len(xs) == 0: - return () - return TransposeSequence(len(xs[0])).apply(xs) + ys = TransposeSequence()(*xs) + if not isinstance(ys, tuple): + ys = (ys,) + return ys
Transpose a list of Variables. - This function transposes a list of :class:`~chainer.Variable` s and returns ? -------- + This function transposes a list of :class:`~chainer.Variable`\\ s and ? ...
false
false
chainer/functions/array/transpose_sequence.py
transpose_sequence.py
chainer
chainer
chainer_
leaky_relu
[ { "version": "v21", "docstring_lines": { "start_line": 88, "end_line": 119 }, "code_lines": { "start_line": 119, "end_line": 120 }, "commit_date_time": "2017-08-22 08:31:34", "commit_sha": "bca94b57e2236280bc87be624274e284932d600b", "commit_message": "Copy gy"...
def leaky_relu(x, slope=0.2): - return LeakyReLU(slope).apply((x,))[0] ? ------- - ---- + return LeakyReLU(slope)(x)
Leaky Rectified Linear Unit function. This function is expressed as - .. math:: f(x)=\\max(x, ax), + .. math:: + + f(x) = \\left \\{ \\begin{array}{ll} + x & {\\rm if}~ x \\ge 0 \\\\ + ax & {\\rm if}~ x < 0, + \\end{array} \\right. where :math:`a` is a co...
false
false
chainer/functions/activation/leaky_relu.py
leaky_relu.py
chainer
chainer
chainer_
negative_sampling
[ { "version": "v63", "docstring_lines": { "start_line": 318, "end_line": 377 }, "code_lines": { "start_line": 377, "end_line": 381 }, "commit_date_time": "2018-10-24 04:41:39", "commit_sha": "dee05c00b11be8def83f5536a5f39a0e31494e1b", "commit_message": "Support...
- def negative_sampling(x, t, W, sampler, sample_size, reduce='sum'): + def negative_sampling(x, t, W, sampler, sample_size, reduce='sum', **kwargs): ? ++++++++++ - - return ( + # NOQA + return_samples = False + if kwargs...
+ negative_sampling(x, t, W, sampler, sample_size, reduce='sum', *, return_samples=False) + - Negative sampling loss function. + Negative sampling loss function. ? ++++ In natural language processing, especially language modeling, the number of words in a vocabulary can be very large. Therefo...
false
false
chainer/functions/loss/negative_sampling.py
negative_sampling.py
chainer
chainer
chainer_
rrelu
[ { "version": "v28", "docstring_lines": { "start_line": 89, "end_line": 139 }, "code_lines": { "start_line": 139, "end_line": 154 }, "commit_date_time": "2018-11-26 07:45:03", "commit_sha": "a5256d59a6addab545ee19c11f5d9b1724a1e15f", "commit_message": "Use :ref...
def rrelu(x, l=1. / 8, u=1. / 3, **kwargs): r = None return_r = False if kwargs: r, return_r = argument.parse_kwargs( kwargs, ('r', r), ('return_r', r), train='train argument is not supported anymore.' 'Use chainer.using_config'...
rrelu(x, l=1. / 8, u=1. / 3, *, r=None, return_r=False) Randomized Leaky Rectified Liner Unit function. This function is expressed as .. math:: f(x)=\\max(x, ax), where :math:`a` is a random number sampled from a uniform distribution :math:`U(l, u)`. See: https://arx...
false
false
chainer/functions/activation/rrelu.py
rrelu.py
chainer
chainer
chainer_
bernoulli_nll
[ { "version": "v28", "docstring_lines": { "start_line": 126, "end_line": 169 }, "code_lines": { "start_line": 169, "end_line": 184 }, "commit_date_time": "2019-01-29 02:04:48", "commit_sha": "6323a18043120591e92bc83712de90d484e58027", "commit_message": "Fix imp...
def bernoulli_nll(x, y, reduce='sum'): if reduce not in ('sum', 'mean', 'no'): raise ValueError( - "only 'sum', 'mean' and 'no' are valid for 'reduce', but '%s'" ? ^ ---- + 'only \'sum\', \'me...
Computes the negative log-likelihood of a Bernoulli distribution. This function calculates the negative log-likelihood of a Bernoulli distribution. .. math:: -\\log B(x; p) = -\\sum_i \\{x_i \\log(p_i) + \ (1 - x_i)\\log(1 - p_i)\\}, where :math:`p = \\sigma(y)`...
false
false
chainer/functions/loss/vae.py
vae.py
chainer
chainer
chainer_
gaussian_nll
[ { "version": "v15", "docstring_lines": { "start_line": 78, "end_line": 114 }, "code_lines": { "start_line": 114, "end_line": 131 }, "commit_date_time": "2017-04-11 05:08:25", "commit_sha": "fcb98f4ba6631d7c42651bcfc4ed57bf489c5af1", "commit_message": "Add redu...
- def gaussian_nll(x, mean, ln_var, reduce='sum'): ? -------------- + def gaussian_nll(x, mean, ln_var): assert isinstance(x, variable.Variable) assert isinstance(mean, variable.Variable) assert isinstance(ln_var, variable.Variable) + D = x.size...
Computes the negative log-likelihood of a Gaussian distribution. Given two variable ``mean`` representing :math:`\\mu` and ``ln_var`` - representing :math:`\\log(\\sigma^2)`, this function computes in ? ^^^^ ^^ ^ + representing :math:`\\log(...
false
false
chainer/functions/loss/vae.py
vae.py
chainer
chainer
chainer_
sparse_matmul
[ { "version": "v27", "docstring_lines": { "start_line": 397, "end_line": 420 }, "code_lines": { "start_line": 420, "end_line": 437 }, "commit_date_time": "2018-08-21 07:40:24", "commit_sha": "5c42aacc4dbacd37bcff67cd654f276181355ad2", "commit_message": "Avoid m...
def sparse_matmul(a, b, transa=False, transb=False): if (isinstance(a, utils.CooMatrix) and isinstance(b, (chainer.Variable, numpy.ndarray, cuda.ndarray))): - return CooMatMul(a.row, a.col, a.shape, + return CooMatMul(a.row, a.col, a.shape, a.order, ? ...
Computes the batched multiplication of sparse and dense matrix. The following use cases are supported: 1. C (dense) = A (sparse) * B (dense) 2. C (dense) = A (dense) * B (sparse) Args: a (~chainer.Variable or ~chainer.utils.CooMatrix): The left operand of ...
false
false
chainer/functions/math/sparse_matmul.py
sparse_matmul.py
chainer
chainer
chainer_
max_pooling_1d
[ { "version": "v33", "docstring_lines": { "start_line": 195, "end_line": 224 }, "code_lines": { "start_line": 224, "end_line": 225 }, "commit_date_time": "2017-12-18 04:50:48", "commit_sha": "15e09edfc85f8c8fde9dd9259576766f9145e4b5", "commit_message": "Add ave...
def max_pooling_1d(x, ksize, stride=None, pad=0): + if len(x.shape[2:]) != 1: + raise ValueError( + 'The number of dimensions under channel dimension of the input ' + '\'x\' should be 1. But the actual ndim was {}.'.fromat( + len(x.shape[2:]))) ...
1-dimensional spatial max pooling function. .. warning:: This feature is experimental. The interface can change in the future. + .. note:: - This function calls :func:`~functions.max_pooling_nd` with - ``ndim = 1``. This acts similarly to - :class:`~functions.Convolution1D`, b...
false
false
chainer/functions/pooling/max_pooling_nd.py
max_pooling_nd.py
chainer
chainer
chainer_
inv
[ { "version": "v2", "docstring_lines": { "start_line": 107, "end_line": 117 }, "code_lines": { "start_line": 117, "end_line": 120 }, "commit_date_time": "2015-11-10 01:01:34", "commit_sha": "d59de3c28d55a8684b8426a2650a803e6f6f26ce", "commit_message": "FEAT: Ma...
def inv(a): + return Inv()(a) - shape = (1, a.data.shape[0], a.data.shape[1]) - batched_a = Reshape(shape)(a) - return BatchInv()(batched_a)
Computes the inverse of of square matrix. Args: a (Variable): Input array to compute the determinant for. - Shape of the array should be (n, n) where n is the dimensionality ? --------------- + Shape of the array should be `...
false
false
chainer/functions/math/inv.py
inv.py
chainer
chainer
chainer_
linear
[ { "version": "v45", "docstring_lines": { "start_line": 178, "end_line": 191 }, "code_lines": { "start_line": 191, "end_line": 195 }, "commit_date_time": "2015-10-13 10:09:28", "commit_sha": "867455a1fa54cfc1b3b532d5d97e0e4b31c079db", "commit_message": "Use typ...
def linear(x, W, b=None): if b is None: - return NonparameterizedLinear()(x, W) + return LinearFunction()(x, W) else: - return NonparameterizedLinear()(x, W, b) + return LinearFunction()(x, W, b)
- Nonparameterized linear function. + Linear function, or affine transformation. + + It accepts two or three arguments: an input minibatch ``x``, a weight + matrix ``W``, and optionally a bias vector ``b``. It computes + :math:`Y = xW^\top + b`. Args: - x (~chainer.Variable): Input variabl...
false
false
chainer/functions/connection/linear.py
linear.py
chainer
chainer
chainer_
deconvolution_1d
[ { "version": "v41", "docstring_lines": { "start_line": 441, "end_line": 587 }, "code_lines": { "start_line": 587, "end_line": 593 }, "commit_date_time": "2017-12-18 04:50:48", "commit_sha": "15e09edfc85f8c8fde9dd9259576766f9145e4b5", "commit_message": "Add ave...
def deconvolution_1d(x, W, b=None, stride=1, pad=0, outsize=None): + + + if len(x.shape[2:]) != 1: + raise ValueError( + 'The number of dimensions under channel dimension of the input ' + '\'x\' should be 1. But the actual ndim was {}.'.fromat( + le...
1-dimensional deconvolution function. .. note:: This function calls :func:`~chainer.functions.deconvolution_nd` with + ``ndim = 1``, so see the details of the behavior in + :func:`~chainer.functions.deconvolution_nd`. - ``ndim = 1``. - - This is an implementa...
false
false
chainer/functions/connection/deconvolution_nd.py
deconvolution_nd.py
chainer
chainer
chainer_
local_response_normalization
[ { "version": "v30", "docstring_lines": { "start_line": 139, "end_line": 164 }, "code_lines": { "start_line": 164, "end_line": 165 }, "commit_date_time": "2018-02-14 01:13:41", "commit_sha": "5b26f3c919b0d81163e6f56b43036c8820215e0b", "commit_message": "iDeep: ...
def local_response_normalization(x, n=5, k=2, alpha=1e-4, beta=.75): - return LocalResponseNormalization(n, k, alpha, beta)(x) + return LocalResponseNormalization(n, k, alpha, beta).apply((x,))[0] ? +++++++ + ++++
Local response normalization across neighboring channels. This function implements normalization across channels. Let :math:`x` an input image with :math:`N` channels. Then, this function computes an output image :math:`y` by following formula: .. math:: y_i = {x_i \\over \\left...
false
false
chainer/functions/normalization/local_response_normalization.py
local_response_normalization.py
chainer
chainer
chainer_
convolution_1d
[ { "version": "v64", "docstring_lines": { "start_line": 546, "end_line": 670 }, "code_lines": { "start_line": 670, "end_line": 675 }, "commit_date_time": "2017-12-18 04:50:48", "commit_sha": "15e09edfc85f8c8fde9dd9259576766f9145e4b5", "commit_message": "Add ave...
def convolution_1d(x, W, b=None, stride=1, pad=0, cover_all=False): + if len(x.shape[2:]) != 1: + raise ValueError( + 'The number of dimensions under channel dimension of the input ' + '\'x\' should be 1. But the actual ndim was {}.'.fromat( + len(x...
1-dimensional convolution function. - - This function calls :func:`~chainer.functions.convolution_nd` internally. - It takes three variables: the input ``x``, the filter weight ``W`` and the - bias vector ``b``. - - Notation: here is a notation for dimensionalities. - - - :math:`n` is the batch...
false
false
chainer/functions/connection/convolution_nd.py
convolution_nd.py
chainer
chainer
chainer_
average_pooling_nd
[ { "version": "v51", "docstring_lines": { "start_line": 213, "end_line": 250 }, "code_lines": { "start_line": 250, "end_line": 254 }, "commit_date_time": "2018-06-12 13:46:18", "commit_sha": "18a5fa50121b2ac1103f01520a24c2d6782d56a4", "commit_message": "Remove ...
def average_pooling_nd(x, ksize, stride=None, pad=0, pad_value=0): + if backend.get_array_module(x) is chainerx: + if pad_value == 0: + pad_mode = 'zero' + elif pad_value is None: + pad_mode = 'ignore' + else: + raise ValueError( + ...
N-dimensionally spatial average pooling function. .. warning:: This feature is experimental. The interface can change in the future. This function provides a N-dimensionally generalized version of - :func:`~functions.average_pooling_2d`. This acts similarly to + :func:`~chainer....
false
false
chainer/functions/pooling/average_pooling_nd.py
average_pooling_nd.py
chainer
chainer
chainer_
average_pooling_1d
[ { "version": "v34", "docstring_lines": { "start_line": 188, "end_line": 220 }, "code_lines": { "start_line": 220, "end_line": 221 }, "commit_date_time": "2017-12-18 04:50:48", "commit_sha": "15e09edfc85f8c8fde9dd9259576766f9145e4b5", "commit_message": "Add ave...
def average_pooling_1d(x, ksize, stride=None, pad=0): + if len(x.shape[2:]) != 1: + raise ValueError( + 'The number of dimensions under channel dimension of the input ' + '\'x\' should be 1. But the actual ndim was {}.'.fromat( + len(x.shape[2:]))) ...
1-dimensional spatial average pooling function. .. warning:: This feature is experimental. The interface can change in the future. - This function calls :func:`~functions.average_pooling_nd` with - ``ndim = 1``. This acts similarly to - :class:`~functions.Convolution1D`, but it co...
false
false
chainer/functions/pooling/average_pooling_nd.py
average_pooling_nd.py
chainer
chainer
chainer_
im2col
[ { "version": "v3", "docstring_lines": { "start_line": 72, "end_line": 131 }, "code_lines": { "start_line": 131, "end_line": 132 }, "commit_date_time": "2017-04-03 06:26:52", "commit_sha": "a06c592c6e9ff92076866506edad1581f6402292", "commit_message": "remove un...
def im2col(x, ksize, stride=1, pad=0, cover_all=False, dilate=1): - return Im2Col(ksize, stride, pad, cover_all, dilate)(x) + return Im2Col(ksize, stride, pad, cover_all, dilate).apply((x,))[0] ? +++++++ + ++++
Extract patches from an image based on the filter. - This function rearranges patches of an image and put them in the channel + This function rearranges patches of an image and puts them in the channel ? + dimension of the output. Patc...
false
false
chainer/functions/array/im2col.py
im2col.py
chainer
chainer
chainer_
reshape
[ { "version": "v37", "docstring_lines": { "start_line": 52, "end_line": 96 }, "code_lines": { "start_line": 96, "end_line": 103 }, "commit_date_time": "2018-10-01 07:24:40", "commit_sha": "5987ffba2a2a9e34f276f9fc6b0b1b6356c8bbaf", "commit_message": "Add functi...
def reshape(x, shape): - if backend.get_array_module(x) is chainerx: - return function._chainerx_op(lambda a: a.reshape(shape), x) - if x.shape == shape: return chainer.as_variable(x) y, = Reshape(shape).apply((x,)) return y
Reshapes an input variable without copy. Args: x (:class:`~chainer.Variable` or :class:`numpy.ndarray` or \ :class:`cupy.ndarray`): Input variable. shape (:class:`tuple` of :class:`int` s): Expected shape of the output array. The number of elements which ...
false
false
chainer/functions/array/reshape.py
reshape.py
chainer
chainer
chainer_utils_type_check.py
TypeInfoTuple.size
[ { "version": "v26", "docstring_lines": { "start_line": 43, "end_line": 48 }, "code_lines": { "start_line": 48, "end_line": 50 }, "commit_date_time": "2015-07-06 07:26:54", "commit_sha": "625d72c5c1cc6ed2362b8c3879365bd567ad1073", "commit_message": "Fix and add...
def size(self): - return Member(len(self), self.name, 'size') + return Variable(len(self), '{0}.size'.format(self.name))
Returns an expression representing its length. Returns: - :class:`Expr` object representig length of the tuple. ? -------- ^ + Expr: An expression object representig length of the tuple. ? ^^^^^^^^^^^^^^^
false
false
chainer/utils/type_check.py
type_check.py
chainer
chainer
chainer_utils_type_check.py
expect_broadcast_shapes
[ { "version": "v80", "docstring_lines": { "start_line": 591, "end_line": 598 }, "code_lines": { "start_line": 598, "end_line": 618 }, "commit_date_time": "2018-06-08 01:11:13", "commit_sha": "1d4c66f925c19edd4a4905d20951d8b0ad9a6c39", "commit_message": "Add a c...
- def expect_broadcast_shapes(*shape_types, **kwargs): ? ---------- + def expect_broadcast_shapes(*shape_types): - ignore_tail, = argument.parse_kwargs(kwargs, ('ignore_tail', 0)) shapes = [eval(s) for s in shape_types] error = None try: ...
- Checks if two shapes are broadcastable at first some axes. + Checks if shapes can be broadcasted together. Args: shapes_types: Type-checked shapes of the arrays to broadcast. - ignore_tail (int): Number of axes at the tail to ignore.
false
false
chainer/utils/type_check.py
type_check.py
chainer
chainer
mycroft_skills_common_play_skill.py
CommonPlaySkill.CPS_send_status
[ { "version": "v11", "docstring_lines": { "start_line": 228, "end_line": 244 }, "code_lines": { "start_line": 244, "end_line": 253 }, "commit_date_time": "2020-07-20 11:45:14", "commit_sha": "45cb8bec62e90965d376843171dff27e7fd98b32", "commit_message": "Add mes...
def CPS_send_status(self, artist='', track='', album='', image='', - **kwargs): + uri='', track_length=None, elapsed_time=None, + playlist_position=None, + status=CPSTrackStatus.DISAMBIGUATION, **kwargs): ...
Inform system of playback status. If a skill is handling playback and wants the playback control to be aware of it's current status it can emit this message indicating that it's performing playback and can provide some standard info. All parameters are optional so any can...
false
false
mycroft/skills/common_play_skill.py
common_play_skill.py
mycroft-core
MycroftAI
mycroft_skills_common_play_skill.py
CommonPlaySkill.CPS_send_tracklist
[ { "version": "v12", "docstring_lines": { "start_line": 278, "end_line": 285 }, "code_lines": { "start_line": 285, "end_line": 290 }, "commit_date_time": "2020-08-11 04:58:45", "commit_sha": "8f4847ff77e7621079ec5157e471374b63fe06a6", "commit_message": "Status ...
- def CPS_send_tracklist(self, tracklist=None): ? ----- + def CPS_send_tracklist(self, tracklist): tracklist = tracklist or [] if not isinstance(tracklist, list): tracklist = [tracklist] for idx, track in enumerate(...
Inform system of playlist track info. Provides track data for playlist Arguments: - tracklist (str/list): Tracklist data ? ---- + tracklist (list/dict): Tracklist data ? +++++
false
false
mycroft/skills/common_play_skill.py
common_play_skill.py
mycroft-core
MycroftAI
Lib_platform.py
_sys_version
[ { "version": "v64", "docstring_lines": { "start_line": 448, "end_line": 465 }, "code_lines": { "start_line": 465, "end_line": 547 }, "commit_date_time": "2008-09-04 11:21:28", "commit_sha": "f4e2ccf3b3191a796b0b8631f686363b3b97dcce", "commit_message": "Issue #...
- def _sys_version(): + def _sys_version(sys_version=None): - global _sys_version_cache + # Get the Python version + if sys_version is None: + sys_version = sys.version - if _sys_version_cache is not None: - return _sys_version_cache + # Try the cache first + ...
Returns a parsed version of Python's sys.version as tuple - (version, buildno, builddate, compiler) referring to the Python + (name, version, branch, revision, buildno, builddate, compiler) + referring to the Python implementation name, version, branch, - version, build number, build dat...
false
false
Lib/platform.py
platform.py
cpython
python
Lib_platform.py
_syscmd_ver
[ { "version": "v164", "docstring_lines": { "start_line": 413, "end_line": 423 }, "code_lines": { "start_line": 423, "end_line": 460 }, "commit_date_time": "2013-12-08 23:01:27", "commit_sha": "620c48b7ea7a1ad3af23725afdac1e6a2b3e6cef", "commit_message": "Issue ...
def _syscmd_ver(system='', release='', version='', - supported_platforms=('win32','win16','dos','os2')): ? ------ + supported_platforms=('win32', 'win16', 'dos')): ? + + ...
Tries to figure out the OS version used and returns - a tuple (system,release,version). + a tuple (system, release, version). ? + + It uses the "ver" shell command for this which is known - to exists on Windows, DOS and OS/2. XXX Others too ? ? ...
false
false
Lib/platform.py
platform.py
cpython
python
skimage_segmentation__join.py
relabel_from_one
[ { "version": "v6", "docstring_lines": { "start_line": 46, "end_line": 98 }, "code_lines": { "start_line": 98, "end_line": 110 }, "commit_date_time": "2013-10-02 16:14:21", "commit_sha": "628d484942d376177a60aab866269a06feec4abd", "commit_message": "DOC: no imp...
def relabel_from_one(label_field): + return relabel_sequential(label_field, offset=1) - labels = np.unique(label_field) - labels0 = labels[labels != 0] - m = labels.max() - if m == len(labels0): # nothing to do, already 1...n labels - return label_field, labels, labels - ...
Convert labels in an arbitrary label field to {1, ... number_of_labels}. + This function is deprecated, see ``relabel_sequential`` for more. - This function also returns the forward map (mapping the original labels to - the reduced labels) and the inverse map (mapping the reduced labels back - to t...
false
false
skimage/segmentation/_join.py
_join.py
scikit-image
scikit-image
skimage_segmentation__join.py
relabel_sequential
[ { "version": "v24", "docstring_lines": { "start_line": 56, "end_line": 119 }, "code_lines": { "start_line": 119, "end_line": 142 }, "commit_date_time": "2020-02-19 16:35:38", "commit_sha": "15c2dc92f8c57b278317676e55600d4069660cea", "commit_message": "Tweak re...
def relabel_sequential(label_field, offset=1): - offset = int(offset) if offset <= 0: raise ValueError("Offset must be strictly positive.") if np.min(label_field) < 0: raise ValueError("Cannot relabel array that contains negative values.") + offset = int(offset) -...
Relabel arbitrary labels to {`offset`, ... `offset` + number_of_labels}. This function also returns the forward map (mapping the original labels to the reduced labels) and the inverse map (mapping the reduced labels back to the original ones). Parameters ---------- label_fiel...
false
false
skimage/segmentation/_join.py
_join.py
scikit-image
scikit-image
research_deep_speech_decoder.py
DeepSpeechDecoder.cer
[ { "version": "v1", "docstring_lines": { "start_line": 199, "end_line": 199 }, "code_lines": { "start_line": 200, "end_line": 207 }, "commit_date_time": "2018-07-09 17:08:43", "commit_sha": "1635e56144ad4289faa7441f20c4b27a02e41dac", "commit_message": "Add eval...
- def cer(self, output, target): ? ^^^^^ + def cer(self, decode, target): ? +++ ^^ - return distance.edit_distance(output, target) ? ^^^^^ + return distance.edit_distance(decode, target) ? +++ ^^
Computes the Character Error Rate (CER). - CER is defined as the edit distance between the given strings. ? - + CER is defined as the edit distance between the two given strings. ? ++++ Args: - output: a string of the decoded ou...
false
false
research/deep_speech/decoder.py
decoder.py
models
tensorflow
sklearn_conftest.py
pyplot
[ { "version": "v6", "docstring_lines": { "start_line": 163, "end_line": 174 }, "code_lines": { "start_line": 174, "end_line": 180 }, "commit_date_time": "2021-06-11 20:56:55", "commit_sha": "038c5cd04558e572b6a4dea7383a515ff10090e5", "commit_message": "MAINT Mo...
def pyplot(): - matplotlib = pytest.importorskip('matplotlib') - matplotlib.use('agg') pyplot = pytest.importorskip('matplotlib.pyplot') + pyplot.close('all') yield pyplot pyplot.close('all')
Setup and teardown fixture for matplotlib. This fixture checks if we can import matplotlib. If not, the tests will be - skipped. Otherwise, we setup matplotlib backend and close the figures - after running the functions. + skipped. Otherwise, we close the figures before and after running the + ...
false
false
sklearn/conftest.py
conftest.py
scikit-learn
scikit-learn
official_vision_ops_preprocess_ops.py
normalize_image
[ { "version": "v21", "docstring_lines": { "start_line": 87, "end_line": 99 }, "code_lines": { "start_line": 99, "end_line": 110 }, "commit_date_time": "2023-05-09 06:15:16", "commit_sha": "526e80f0c03b876757f845b3e8cb5c61f7c96e2f", "commit_message": "Internal c...
def normalize_image(image: tf.Tensor, offset: Sequence[float] = MEAN_NORM, - scale: Sequence[float] = STDDEV_NORM): + scale: Sequence[float] = STDDEV_NORM) -> tf.Tensor: ? +++++++++++++ + ...
Normalizes the image to zero mean and unit variance. + + If the input image dtype is float, it is expected to either have values in + [0, 1) and offset is MEAN_NORM, or have values in [0, 255] and offset is + MEAN_RGB. + + Args: + image: A tf.Tensor in either (1) float dtype with values in range [0, 1) ...
false
false
official/vision/ops/preprocess_ops.py
preprocess_ops.py
models
tensorflow
official_vision_ops_preprocess_ops.py
resize_and_crop_masks
[ { "version": "v12", "docstring_lines": { "start_line": 582, "end_line": 596 }, "code_lines": { "start_line": 596, "end_line": 618 }, "commit_date_time": "2022-08-12 20:17:05", "commit_sha": "b287dfd96131b432c2f12a16f8bf64d75f603c1b", "commit_message": "Add a n...
+ def resize_and_crop_masks(masks, image_scale, output_size, offset): - def resize_and_crop_masks(masks, - image_scale, - output_size, - offset): with tf.name_scope('resize_and_crop_masks'): mask_size = tf.cast(tf.shape(ma...
Resizes boxes to output size with scale and offset. Args: - masks: `Tensor` of shape [N, H, W, 1] representing ground truth masks. ? ^ + masks: `Tensor` of shape [N, H, W, C] representing ground truth masks. ? ^ image...
false
false
official/vision/ops/preprocess_ops.py
preprocess_ops.py
models
tensorflow
official_vision_ops_preprocess_ops.py
center_crop_image
[ { "version": "v16", "docstring_lines": { "start_line": 395, "end_line": 395 }, "code_lines": { "start_line": 396, "end_line": 414 }, "commit_date_time": "2023-02-27 22:52:50", "commit_sha": "f52e5853db3b28b16e16e94b99ad56564a425961", "commit_message": "Interna...
- def center_crop_image(image): ? ------- + def center_crop_image( + image, center_crop_fraction: float = CENTER_CROP_FRACTION): with tf.name_scope('center_crop_image'): image_size = tf.cast(tf.shape(image)[:2], dtype=tf.float32) crop_size = ( - CENTER_CROP_F...
Center crop a square shape slice from the input image. It crops a square shape slice from the image. The side of the actual crop is 224 / 256 = 0.875 of the short side of the original image. References: [1] Very Deep Convolutional Networks for Large-Scale Image Recognition https://arxiv.org/abs...
false
false
official/vision/ops/preprocess_ops.py
preprocess_ops.py
models
tensorflow
official_vision_ops_preprocess_ops.py
random_crop_image
[ { "version": "v28", "docstring_lines": { "start_line": 601, "end_line": 615 }, "code_lines": { "start_line": 615, "end_line": 623 }, "commit_date_time": "2024-02-27 23:24:49", "commit_sha": "6a8359dbb12b6f1809fa55ec4102b07df69eb703", "commit_message": "No publ...
- def random_crop_image(image, ? ------ + def random_crop_image( + image, - aspect_ratio_range=(3. / 4., 4. / 3.), ? ------------------ + aspect_ratio_range=(3.0 / 4.0, 4.0 / 3.0), ? + + + + - area_range=(0...
Randomly crop an arbitrary shaped slice from the input image. Args: image: a Tensor of shape [height, width, 3] representing the input image. aspect_ratio_range: a list of floats. The cropped area of the image must have an aspect ratio = width / height within this range. - area_range: a...
false
false
official/vision/ops/preprocess_ops.py
preprocess_ops.py
models
tensorflow
official_vision_ops_preprocess_ops.py
resize_and_crop_image
[ { "version": "v29", "docstring_lines": { "start_line": 666, "end_line": 680 }, "code_lines": { "start_line": 680, "end_line": 688 }, "commit_date_time": "2024-03-12 20:48:32", "commit_sha": "8a8d6302052c618dc5b0615d1a08a527a9dd930e", "commit_message": "No publ...
def resize_and_crop_image( image, desired_size, padded_size, aug_scale_min=1.0, aug_scale_max=1.0, seed=1, method=tf.image.ResizeMethod.BILINEAR, keep_aspect_ratio=True, + centered_crop=False, ): with tf.name_scope('resize_and_crop_image'): ima...
Resizes the input image to output size (RetinaNet style). Resize and pad images given the desired output size of the image and stride size. Here are the preprocessing steps. 1. For a given image, keep its aspect ratio and rescale the image to make it the largest rectangle to be bounded by...
false
false
official/vision/ops/preprocess_ops.py
preprocess_ops.py
models
tensorflow
theano_tensor_raw_random.py
uniform
[ { "version": "v53", "docstring_lines": { "start_line": 180, "end_line": 183 }, "code_lines": { "start_line": 183, "end_line": 197 }, "commit_date_time": "2010-01-27 20:23:00", "commit_sha": "28e2a65ac2fd1ee3d15dd07bd16c59600e74ae7b", "commit_message": "Replaci...
- def uniform(random_state, size=(), low=0.0, high=1.0, ndim=None): ? ^^ + def uniform(random_state, size=None, low=0.0, high=1.0, ndim=None): ? ^^^^ + low = tensor.as_tensor_variable(low) + high = tensor.as_tensor_variable(hig...
Sample from a uniform distribution between low and high. - If the size argument is ambiguous on the number of + If the size argument is ambiguous on the number of dimensions, ndim ? +++++++++++++++++ - dimensions, the first argument may be a plain ...
false
false
theano/tensor/raw_random.py
raw_random.py
Theano
Theano
theano_tensor_raw_random.py
multinomial
[ { "version": "v89", "docstring_lines": { "start_line": 719, "end_line": 719 }, "code_lines": { "start_line": 720, "end_line": 720 }, "commit_date_time": "2012-02-29 00:32:34", "commit_sha": "7441389b009529bc5b3a2936caf9333f197f85a6", "commit_message": "Format ...
def multinomial(random_state, size=None, n=1, pvals=[0.5, 0.5], - ndim=None, dtype='int64'): + ndim=None, dtype='int64'): ? ++++++++ - n = tensor.as_tensor_variable(n) pvals = tensor.as_tensor_variable(pvals) # until ellipsis is implemented (argh) ...
Sample from one or more multinomial distributions defined by one-dimensional slices in pvals. :param pvals: a tensor of shape "nmulti+(L,)" describing each multinomial distribution. This tensor must have the property that numpy.allclose(pvals.sum(axis=-1), 1) is true. :par...
false
false
theano/tensor/raw_random.py
raw_random.py
Theano
Theano
homeassistant_components_google_calendar.py
GoogleCalendarEventDevice.update
[ { "version": "v38", "docstring_lines": { "start_line": 114, "end_line": 122 }, "code_lines": { "start_line": 122, "end_line": 123 }, "commit_date_time": "2022-02-27 00:19:45", "commit_sha": "deda9e38e49dc006fa5728a9b2104fd17e6e004e", "commit_message": "Simplif...
def update(self) -> None: - self.data.update() - event = copy.deepcopy(self.data.event) - if event is None: - self._event = event + try: + items, _ = self._calendar_service.list_events( + self._calendar_id, search=self._search + ...
- Update event data. + Get the latest data.
false
false
homeassistant/components/google/calendar.py
calendar.py
core
home-assistant
sklearn_tree__classes.py
DecisionTreeClassifier.fit
[ { "version": "v467", "docstring_lines": { "start_line": 1281, "end_line": 1314 }, "code_lines": { "start_line": 1314, "end_line": 1323 }, "commit_date_time": "2021-10-14 16:07:10", "commit_sha": "c23ff7ea15ce6bdcf35f62d07c8f2b5cbb941ca0", "commit_message": "DO...
+ def fit(self, X, y, sample_weight=None, check_input=True): - def fit( - self, X, y, sample_weight=None, check_input=True, X_idx_sorted="deprecated" - ): super().fit( X, y, sample_weight=sample_weight, check_input=ch...
Build a decision tree classifier from the training set (X, y). Parameters ---------- X : {array-like, sparse matrix} of shape (n_samples, n_features) The training input samples. Internally, it will be converted to ``dtype=np.float32`` and if a sparse matrix...
false
false
sklearn/tree/_classes.py
_classes.py
scikit-learn
scikit-learn
sklearn_tree__classes.py
DecisionTreeRegressor._compute_partial_dependence_recursion
[ { "version": "v492", "docstring_lines": { "start_line": 1386, "end_line": 1402 }, "code_lines": { "start_line": 1402, "end_line": 1411 }, "commit_date_time": "2023-12-07 15:27:54", "commit_sha": "8b951948880e12e6bdf7725621f662ca1de0a5ec", "commit_message": "FI...
def _compute_partial_dependence_recursion(self, grid, target_features): grid = np.asarray(grid, dtype=DTYPE, order="C") averaged_predictions = np.zeros( shape=grid.shape[0], dtype=np.float64, order="C" ) + target_features = np.asarray(target_fe...
Fast partial dependence computation. Parameters ---------- - grid : ndarray of shape (n_samples, n_target_features) + grid : ndarray of shape (n_samples, n_target_features), dtype=np.float32 ? ++++++++++++++++++ ...
false
false
sklearn/tree/_classes.py
_classes.py
scikit-learn
scikit-learn
theano_tensor_nlinalg.py
qr
[ { "version": "v42", "docstring_lines": { "start_line": 537, "end_line": 595 }, "code_lines": { "start_line": 595, "end_line": 602 }, "commit_date_time": "2016-08-30 19:43:01", "commit_sha": "1cda3cfcb002c76ffbe472f551cdba2d91b8c60b", "commit_message": "Fix reb...
- def qr(a, mode="full"): ? ^ ^^ + def qr(a, mode="reduced"): ? ^^^ ^^^ x = [[2, 1], [3, 4]] if isinstance(numpy.linalg.qr(x, mode), tuple): return QRFull(mode)(a) else: return QRIncomplete(mode)(a)
Computes the QR decomposition of a matrix. Factor the matrix a as qr, where q is orthonormal and r is upper-triangular. Parameters ---------- a : array_like, shape (M, N) Matrix to be factored. - mode : {'reduced', 'complete', 'r', 'raw', 'full', 'economic'}, optional...
false
false
theano/tensor/nlinalg.py
nlinalg.py
Theano
Theano
chainer_links_model_vision_resnet.py
ResNet50Layers.extract
[ { "version": "v5", "docstring_lines": { "start_line": 176, "end_line": 198 }, "code_lines": { "start_line": 198, "end_line": 203 }, "commit_date_time": "2016-10-03 00:06:35", "commit_sha": "cb7a2bb952ef16551a922f21782db9259aed4ef5", "commit_message": "Use keys...
def extract(self, images, layers=['pool5'], size=(224, 224)): x = chainer.dataset.concat_examples( - [self.prepare(img, size=size) for img in images]) ? ----- + [prepare(img, size=size) for img in images]) x = Variable(self.xp.asarr...
Extracts all the feature maps of given images. The difference of directly executing ``__call__`` is that it directly accepts the list of images as an input, and automatically transforms them to a proper variable. That is, it is also interpreted as a shortcut method that impl...
false
false
chainer/links/model/vision/resnet.py
resnet.py
chainer
chainer
chainer_links_model_vision_resnet.py
ResNet50Layers.__call__
[ { "version": "v13", "docstring_lines": { "start_line": 155, "end_line": 177 }, "code_lines": { "start_line": 177, "end_line": 181 }, "commit_date_time": "2016-10-19 03:58:11", "commit_sha": "64117c5f1a0579c62fa52e04f4d9bf1dbf2b4fb3", "commit_message": "Add ove...
- def __call__(self, x, layers=['prob']): + def __call__(self, x, layers=['prob'], test=True): ? +++++++++++ h = x activations = {} target_layers = set(layers) for key, funcs in self.functions.items(): ...
Computes all the feature maps specified by ``layers``. Args: x (~chainer.Variable): Input variable. layers (list of str): The list of layernames you want to extract. + test (bool): If ``True``, it runs in test mode. Returns: Dictionary of...
false
false
chainer/links/model/vision/resnet.py
resnet.py
chainer
chainer
chainer_links_model_vision_resnet.py
ResNetLayers.__call__
[ { "version": "v48", "docstring_lines": { "start_line": 183, "end_line": 205 }, "code_lines": { "start_line": 205, "end_line": 209 }, "commit_date_time": "2017-05-22 15:51:46", "commit_sha": "a4aa154d4d6ecec96973c8ad069d72068f08774a", "commit_message": "Add Lin...
- def __call__(self, x, layers=['prob']): + def __call__(self, x, layers=['prob'], **kwargs): ? ++++++++++ + + argument.check_unexpected_kwargs( + kwargs, test='test argument is not supported anymore. ' + 'Use chainer.using_...
+ __call__(self, x, layers=['prob']) + - Computes all the feature maps specified by ``layers``. + Computes all the feature maps specified by ``layers``. ? ++++++++ + + .. warning:: + + ``test`` argument is not supported anymore since v2. + Instead, use ``chainer.using_config('t...
false
false
chainer/links/model/vision/resnet.py
resnet.py
chainer
chainer
chainer_links_model_vision_resnet.py
ResNet50Layers.predict
[ { "version": "v12", "docstring_lines": { "start_line": 181, "end_line": 191 }, "code_lines": { "start_line": 191, "end_line": 194 }, "commit_date_time": "2016-10-19 01:00:12", "commit_sha": "2286aac9832cf60d0be42b574aeb777ae7fd5112", "commit_message": "Fix doc...
- def predict(self, images): + def predict(self, images, oversample=True): ? +++++++++++++++++ + x = concat_examples([prepare(img, size=(256, 256)) for img in images]) + if oversample: + x = imgproc.oversample(x, crop_dims=(224, 224)) + ...
Computes all the probabilities of given images. Args: image (iterable of PIL.Image or numpy.ndarray): Input images. + oversample (bool): If ``True``, it avarages results across + center, corners, and mirrors. Otherwise, it uses only the + center. ...
false
false
chainer/links/model/vision/resnet.py
resnet.py
chainer
chainer
st2api_st2api_controllers_v1_ruletypes.py
RuleTypesController.get_all
[ { "version": "v16", "docstring_lines": { "start_line": 68, "end_line": 74 }, "code_lines": { "start_line": 74, "end_line": 78 }, "commit_date_time": "2017-02-08 12:00:13", "commit_sha": "da06f836f8c4e1f915b0857df692686f5629166f", "commit_message": "Fix additio...
def get_all(self, **kw): - runnertype_dbs = RuleType.get_all(**kw) ? ^^ - + ruletype_dbs = RuleType.get_all(**kw) ? ^ - runnertype_apis = [RuleTypeAPI.from_model(runnertype_db) ? ^^ - + ruletype_apis = [RuleTypeAPI.f...
List all RuleType objects. Handles requests: - GET /runnertypes/ ? ^^ - + GET /ruletypes/ ? ^
false
false
st2api/st2api/controllers/v1/ruletypes.py
ruletypes.py
st2
StackStorm
django_utils_crypto.py
_fast_hmac
[ { "version": "v16", "docstring_lines": { "start_line": 114, "end_line": 117 }, "code_lines": { "start_line": 117, "end_line": 128 }, "commit_date_time": "2012-08-07 10:00:22", "commit_sha": "c5ef65bcf324f4c90b53be90f4aec069a68e8c59", "commit_message": "[py3] P...
def _fast_hmac(key, msg, digest): dig1, dig2 = digest(), digest() - key = smart_bytes(key) if len(key) > dig1.block_size: key = digest(key).digest() - key += chr(0) * (dig1.block_size - len(key)) ? ^^^^ ^ + key += b'\x00' * (dig1.block_size - len(key)...
- A trimmed down version of Python's HMAC implementation + A trimmed down version of Python's HMAC implementation. ? + + + This function operates on bytes.
false
false
django/utils/crypto.py
crypto.py
django
django
django_utils_crypto.py
constant_time_compare
[ { "version": "v18", "docstring_lines": { "start_line": 84, "end_line": 89 }, "code_lines": { "start_line": 89, "end_line": 102 }, "commit_date_time": "2012-08-20 20:50:49", "commit_sha": "62954ba04c86c4cea3b17a872ba6a0837730e17d", "commit_message": "[py3] Fixe...
def constant_time_compare(val1, val2): - if not (isinstance(val1, bytes) and isinstance(val2, bytes)): - raise TypeError("constant_time_compare only supports bytes") if len(val1) != len(val2): return False result = 0 - if six.PY3: + if six.PY3 and isinsta...
- Returns True if the two bytestrings are equal, False otherwise. ? ---- + Returns True if the two strings are equal, False otherwise. The time taken is independent of the number of characters that match.
false
false
django/utils/crypto.py
crypto.py
django
django
lib_training_augmentation.py
ImageAugmentation._random_warp
[ { "version": "v3", "docstring_lines": { "start_line": 379, "end_line": 381 }, "code_lines": { "start_line": 381, "end_line": 397 }, "commit_date_time": "2021-05-14 00:54:26", "commit_sha": "3835f3959deff6294f8277631d453df86253e778", "commit_message": "bugfix: ...
- def _random_warp(self, batch): + def _random_warp(self, batch: np.ndarray) -> np.ndarray: - ? - + + - logger.trace("Randomly warping batch") + logger.trace("Randomly warping batch") # type: ignore ? ++++++++++++++++...
Randomly warp the input batch + + Parameters + ---------- + batch: :class:`numpy.ndarray` + The batch should be a 4-dimensional array of shape (`batchsize`, `height`, `width`, + `3`) and in `BGR` format. + + Returns + ---------- + :class:`numpy...
false
false
lib/training/augmentation.py
augmentation.py
faceswap
deepfakes
Parser_asdl_c.py
is_simple
[ { "version": "v196", "docstring_lines": { "start_line": 75, "end_line": 80 }, "code_lines": { "start_line": 80, "end_line": 84 }, "commit_date_time": "2021-06-24 12:16:00", "commit_sha": "6c76df2b86d742cc294beae7f9b6bafabb946ad5", "commit_message": "bpo-40528:...
- def is_simple(sum): + def is_simple(sum_type): ? +++++ - for t in sum.types: - if t.fields: - return False - return True + + return not ( + sum_type.attributes or + any(constructor.fields for constructor in sum_type.types) + )
Return True if a sum is a simple. - A sum is simple if its types have no fields, e.g. ? ^^ ^^^ + A sum is simple if it's types have no fields and itself ? + ^^^^^^^^ ^^ + doesn't have any attributes. Instance...
false
false
Parser/asdl_c.py
asdl_c.py
cpython
python
t_unit_test_migrations.py
MigrationTests.test_models_match_migrations
[ { "version": "v3", "docstring_lines": { "start_line": 27, "end_line": 33 }, "code_lines": { "start_line": 33, "end_line": 51 }, "commit_date_time": "2021-07-29 16:15:28", "commit_sha": "b6b5878664c7693fd0a932041956a547855cf2be", "commit_message": "enable pre-c...
def test_models_match_migrations(self): + call_command( + "makemigrations", "django_celery_results", "--check", "--dry-run" - app_labels = ['django_celery_results'] - loader = MigrationLoader(None, ignore_no_migrations=True) - questioner = NonInteracti...
- Make sure that no model changes exist. + Make sure that no pending migrations exist for the app. - This logic is taken from django's makemigrations.py file. Here just detect if model changes exist that require a migration, and if so we fail.
false
false
t/unit/test_migrations.py
test_migrations.py
django-celery-results
celery
spacy_displacy___init__.py
parse_ents
[ { "version": "v44", "docstring_lines": { "start_line": 182, "end_line": 187 }, "code_lines": { "start_line": 187, "end_line": 197 }, "commit_date_time": "2021-10-14 13:21:40", "commit_sha": "657af5f91f88bb5a414ae133a99465dbc4f240be", "commit_message": "🏷 Add ...
def parse_ents(doc: Doc, options: Dict[str, Any] = {}) -> Dict[str, Any]: + kb_url_template = options.get("kb_url_template", None) ents = [ - {"start": ent.start_char, "end": ent.end_char, "label": ent.label_} + { + "start": ent.start_char, + "end": ent....
Generate named entities in [{start: i, end: i, label: 'label'}] format. - doc (Doc): Document do parse. ? ^ + doc (Doc): Document to parse. ? ^ + options (Dict[str, Any]): NER-specific visualisation options. RETURNS (dict): Generated entities keye...
false
false
spacy/displacy/__init__.py
__init__.py
spaCy
explosion
sklearn_utils_multiclass.py
is_label_indicator_matrix
[ { "version": "v4", "docstring_lines": { "start_line": 103, "end_line": 132 }, "code_lines": { "start_line": 132, "end_line": 136 }, "commit_date_time": "2013-05-28 06:57:04", "commit_sha": "ecf135a49b65ac74a46459edacff8357b6b4c33c", "commit_message": "ENH fast...
def is_label_indicator_matrix(y): - return (hasattr(y, "shape") and len(y.shape) == 2 and y.shape[1] > 1 and ? ^^ --- ---- ^^^^^^ ^^^^ + if not (hasattr(y, "shape") and y.ndim == 2 and y.shape[1] > 1): ? ^^^^^ ...
Check if ``y`` is in the label indicator matrix format (multilabel). Parameters ---------- y : numpy array of shape [n_samples] or sequence of sequences Target values. In the multilabel case the nested sequences can have variable lengths. Returns ------- o...
false
false
sklearn/utils/multiclass.py
multiclass.py
scikit-learn
scikit-learn
sklearn_utils_multiclass.py
is_multilabel
[ { "version": "v46", "docstring_lines": { "start_line": 234, "end_line": 283 }, "code_lines": { "start_line": 283, "end_line": 319 }, "commit_date_time": "2015-02-01 14:49:49", "commit_sha": "67dcd99d823d6a3726b524f018a91ac8a43423d6", "commit_message": "TST fix...
def is_multilabel(y): - return is_label_indicator_matrix(y) or is_sequence_of_sequences(y) + return is_label_indicator_matrix(y)
Check if ``y`` is in a multilabel format. Parameters ---------- - y : numpy array of shape [n_samples] or sequence of sequences ? ------------------------- + y : numpy array of shape [n_samples] + Target values. - Target values. In the mu...
false
false
sklearn/utils/multiclass.py
multiclass.py
scikit-learn
scikit-learn
spacy_cli_project_run.py
check_rerun
[ { "version": "v11", "docstring_lines": { "start_line": 154, "end_line": 159 }, "code_lines": { "start_line": 159, "end_line": 173 }, "commit_date_time": "2020-09-22 07:45:34", "commit_sha": "6316d5f3989a53e4868cd346256fa614bd49e711", "commit_message": "Improve...
- def check_rerun(project_dir: Path, command: Dict[str, Any]) -> bool: + def check_rerun( + project_dir: Path, + command: Dict[str, Any], + check_spacy_version: bool = True, + check_spacy_commit: bool = False, + ) -> bool: lock_path = project_dir / PROJECT_LOCK if not lock_path...
Check if a command should be rerun because its settings or inputs/outputs changed. project_dir (Path): The current project directory. command (Dict[str, Any]): The command, as defined in the project.yml. + strict_version (bool): RETURNS (bool): Whether to re-run the command.
false
false
spacy/cli/project/run.py
run.py
spaCy
explosion
plugins_convert_writer_opencv.py
Writer.close
[ { "version": "v3", "docstring_lines": { "start_line": 55, "end_line": 57 }, "code_lines": { "start_line": 57, "end_line": 58 }, "commit_date_time": "2019-09-02 21:55:36", "commit_sha": "f0833012a175b169752248caa5938265b1e69ab1", "commit_message": "De-Multiproc...
- def close(self): + def close(self) -> None: ? ++++++++ return
- Image writer does not need a close method ? ^^ ^ + Does nothing as OpenCV writer does not need a close method ? ^^^^^^^^^^^^^ ^^^^ +++
false
false
plugins/convert/writer/opencv.py
opencv.py
faceswap
deepfakes
official_nlp_modeling_layers_cls_head.py
GaussianProcessClassificationHead.call
[ { "version": "v9", "docstring_lines": { "start_line": 256, "end_line": 271 }, "code_lines": { "start_line": 271, "end_line": 287 }, "commit_date_time": "2021-04-05 22:58:30", "commit_sha": "2ae06c8a6447453558e972313aa9d8a29bb86491", "commit_message": "Adds `ca...
- def call(self, features, return_covmat=False): + def call(self, features, training=False, return_covmat=False): ? ++++++++++++++++ logits = super().call(features) # Extracts logits and covariance matrix from model output. if self.use_gp_layer: logits...
Returns model output. + + Dring training, the model returns raw logits. During evaluation, the model + returns uncertainty adjusted logits, and (optionally) the covariance matrix. Arguments: features: A tensor of input features, shape (batch_size, feature_dim). + training: Whether the ...
false
false
official/nlp/modeling/layers/cls_head.py
cls_head.py
models
tensorflow
st2common_st2common_util_sandboxing.py
get_sandbox_python_path_for_python_action
[ { "version": "v17", "docstring_lines": { "start_line": 130, "end_line": 134 }, "code_lines": { "start_line": 134, "end_line": 167 }, "commit_date_time": "2018-09-21 14:03:30", "commit_sha": "175b5ed7695e8014e9492b190f790c53a7242325", "commit_message": "Only pe...
def get_sandbox_python_path_for_python_action(pack, inherit_from_parent=True, inherit_parent_virtualenv=True): sandbox_python_path = get_sandbox_python_path( inherit_from_parent=inherit_from_parent, inherit_parent_virtualen...
+ Return sandbox PYTHONPATH for a particular Python runner action. + - Same as get_sandbox_python_path function, but it's intended to be used for Python runner actions ? -------- + Same as get_sandbox_python_path() function, b...
false
false
st2common/st2common/util/sandboxing.py
sandboxing.py
st2
StackStorm
st2common_st2common_util_sandboxing.py
is_pack_virtualenv_using_python3
[ { "version": "v16", "docstring_lines": { "start_line": 168, "end_line": 171 }, "code_lines": { "start_line": 171, "end_line": 191 }, "commit_date_time": "2018-09-21 13:55:46", "commit_sha": "cc3717ec04a90c4fa944eed9acc69915bcafde18", "commit_message": "Bail ou...
def is_pack_virtualenv_using_python3(pack): # If python3.? directory exists in pack virtualenv lib/ path it means Python 3 is used by # that virtual environment and we take that in to account when constructing PYTHONPATH virtualenv_path = get_sandbox_virtualenv_path(pack=pack) ...
Return True if a particular pack virtual environment is used Python 3. + + :return: (uses_python3_bool, virtualenv_directories) + :rtype: ``tuple``
false
false
st2common/st2common/util/sandboxing.py
sandboxing.py
st2
StackStorm
project_euler_problem_003_sol1.py
solution
[ { "version": "v9", "docstring_lines": { "start_line": 44, "end_line": 70 }, "code_lines": { "start_line": 70, "end_line": 95 }, "commit_date_time": "2020-10-15 07:13:28", "commit_sha": "44254cf112fc907b4204dbeb2e927d74ca52e69d", "commit_message": "Rename Proje...
def solution(n: int = 600851475143) -> int: + + try: n = int(n) except (TypeError, ValueError): - raise TypeError("Parameter n must be int or passive of cast to int.") ? ----------- + raise TypeError("Paramet...
Returns the largest prime factor of a given number n. + >>> solution(13195) 29 >>> solution(10) 5 >>> solution(17) 17 >>> solution(3.4) 3 >>> solution(0) Traceback (most recent call last): ... - ValueError: Parameter n must be greater or equal...
false
false
project_euler/problem_003/sol1.py
sol1.py
Python
TheAlgorithms
speechbrain_utils_metric_stats.py
ErrorRateStats.summarize
[ { "version": "v1", "docstring_lines": { "start_line": 174, "end_line": 183 }, "code_lines": { "start_line": 183, "end_line": 189 }, "commit_date_time": "2020-08-11 19:50:07", "commit_sha": "7954004586ba89d781ba92545c887e72d827145b", "commit_message": "Use sub-...
- def summarize(self, full_summary=False): + def summarize(self, just_avg=True): - summary = wer_summary(self.scores) + self.summary = wer_summary(self.scores) ? +++++ - if full_summary: + if just_avg: - return summary + return se...
Summarize the error_rate and return relevant statistics. * See MetricStats.summarize() - - Arguments - --------- - full_summary : bool - Whether to return all the error rate stats, or just the error rate.
false
false
speechbrain/utils/metric_stats.py
metric_stats.py
speechbrain
speechbrain
speechbrain_utils_metric_stats.py
MetricStats.summarize
[ { "version": "v3", "docstring_lines": { "start_line": 167, "end_line": 184 }, "code_lines": { "start_line": 184, "end_line": 196 }, "commit_date_time": "2020-08-16 15:10:37", "commit_sha": "aebde4c0db47659562fab186447f06167f7435f0", "commit_message": "Update a...
- def summarize(self, just_avg=True): + def summarize(self, field=None): min_index = torch.argmin(torch.tensor(self.scores)) max_index = torch.argmax(torch.tensor(self.scores)) self.summary = { - "avg": sum(self.scores) / len(self.scores), + "a...
Summarize the metric scores, returning relevant stats. Arguments --------- - just_avg : bool - Whether to return just the average, or all stats in a dict + field : str + If provided, only returns selected statistic. If not, + returns all compu...
false
false
speechbrain/utils/metric_stats.py
metric_stats.py
speechbrain
speechbrain
speechbrain_utils_metric_stats.py
BinaryMetricStats.summarize
[ { "version": "v59", "docstring_lines": { "start_line": 307, "end_line": 310 }, "code_lines": { "start_line": 310, "end_line": 316 }, "commit_date_time": "2022-01-17 07:43:18", "commit_sha": "5cab96e21a1e793c8b294de21bc5e6d897e3e62b", "commit_message": "fix cod...
+ def summarize(self, field=None, threshold=None, beta=1, eps=1e-8): - def summarize( - self, field=None, threshold=None, max_samples=None, beta=1, eps=1e-8 - ): if isinstance(self.scores, list): self.scores = torch.stack(self.scores) self.label...
Compute statistics using a full set of scores. Full set of fields: - TP - True Positive - TN - True Negative - FP - False Positive - FN - False Negative - FAR - False Acceptance Rate - FRR - False Rejection Rate - DER - Detectio...
false
false
speechbrain/utils/metric_stats.py
metric_stats.py
speechbrain
speechbrain
speechbrain_utils_metric_stats.py
EER
[ { "version": "v27", "docstring_lines": { "start_line": 381, "end_line": 398 }, "code_lines": { "start_line": 398, "end_line": 432 }, "commit_date_time": "2020-12-13 21:11:41", "commit_sha": "f21a5b77d43b225bdc0095aa811b4147804d122a", "commit_message": "fix cor...
def EER(positive_scores, negative_scores): # Computing candidate thresholds thresholds, _ = torch.sort(torch.cat([positive_scores, negative_scores])) thresholds = torch.unique(thresholds) # Adding intermediate thresholds interm_thresholds = (thresholds[0:-1] + thresho...
Computes the EER (and its threshold) Arguments --------- positive_scores : torch.tensor The scores from entries of the same class. negative_scores : torch.tensor The scores from entries of different classes. Example ------- - >>> postive_scores = torch...
false
false
speechbrain/utils/metric_stats.py
metric_stats.py
speechbrain
speechbrain
saleor_graphql_views.py
GraphQLView.parse_query
[ { "version": "v23", "docstring_lines": { "start_line": 114, "end_line": 120 }, "code_lines": { "start_line": 120, "end_line": 133 }, "commit_date_time": "2019-09-23 09:09:11", "commit_sha": "fbabe213b120effb36fa7a566d327ebe964d9a1e", "commit_message": "Add tes...
def parse_query(self, query: str) -> (GraphQLDocument, ExecutionResult): - if not query: + if not query or not isinstance(query, str): return ( None, ExecutionResult( errors=[ValueError("Must provide a query ...
Attempt to parse a query (mandatory) to a gql document object. - If no query was given, it returns an error. + If no query was given or query is not a string, it returns an error. ? +++++++++++++++++++++++++ If the query is invalid, it returns an error as wel...
false
false
saleor/graphql/views.py
views.py
saleor
saleor
tamper_plus2concat.py
tamper
[ { "version": "v16", "docstring_lines": { "start_line": 23, "end_line": 41 }, "code_lines": { "start_line": 41, "end_line": 86 }, "commit_date_time": "2019-05-08 10:47:52", "commit_sha": "9c247b3833a0ed501c50966e8aaed0e4da4ab7ae", "commit_message": "Last prepar...
def tamper(payload, **kwargs): retVal = payload if payload: - prefix, suffix = '+' * len(re.search(r"\A(\+*)", payload).group(0)), '+' * len(re.search(r"(\+*)\Z", payload).group(0)) - retVal = retVal.strip('+') + match = re.search(r"('[^']+'|CHAR\(\d+\))\...
Replaces plus operator ('+') with (MsSQL) function CONCAT() counterpart Tested against: * Microsoft SQL Server 2012 Requirements: * Microsoft SQL Server 2012+ Notes: * Useful in case ('+') character is filtered >>> tamper('SELECT CHAR(113)+CHAR(114)+CH...
false
false
tamper/plus2concat.py
plus2concat.py
sqlmap
sqlmapproject
opendevin_runtime_docker_process.py
DockerProcess.parse_docker_exec_output
[ { "version": "v35", "docstring_lines": { "start_line": 37, "end_line": 66 }, "code_lines": { "start_line": 66, "end_line": 91 }, "commit_date_time": "2024-05-02 17:01:54", "commit_sha": "fadcdc117ea30b2f9bcf8805447418a202114b2f", "commit_message": "Migrate to ...
- def parse_docker_exec_output(self, logs: bytes) -> Tuple[bytes, bytes]: ? ^ + def parse_docker_exec_output(self, logs: bytes) -> tuple[bytes, bytes]: ? ^ res = b'' ...
When you execute a command using `exec` in a docker container, the output produced will be in bytes. this function parses the output of a Docker exec command. Example: Considering you have a docker container named `my_container` up and running $ docker exec my_container echo "...
false
false
opendevin/runtime/docker/process.py
process.py
OpenDevin
OpenDevin
skimage_filters_rank_generic.py
median
[ { "version": "v47", "docstring_lines": { "start_line": 341, "end_line": 373 }, "code_lines": { "start_line": 373, "end_line": 376 }, "commit_date_time": "2016-05-29 10:56:06", "commit_sha": "22320614026da0622c7d3eab7548e973154708ea", "commit_message": "Move de...
- def median(image, selem, out=None, mask=None, shift_x=False, shift_y=False): + def median(image, selem=None, out=None, mask=None, + shift_x=False, shift_y=False): return _apply_scalar_per_pixel(generic_cy._median, image, selem, out=out, mask=ma...
Return local median of an image. Parameters ---------- image : 2-D array (uint8, uint16) Input image. - selem : 2-D array + selem : 2-D array, optional ? ++++++++++ - The neighborhood expressed as a 2-D array of 1's and 0's. + The neighborho...
false
false
skimage/filters/rank/generic.py
generic.py
scikit-image
scikit-image
skimage_filters_rank_generic.py
majority_filter
[ { "version": "v59", "docstring_lines": { "start_line": 1061, "end_line": 1097 }, "code_lines": { "start_line": 1097, "end_line": 1101 }, "commit_date_time": "2019-04-12 10:11:28", "commit_sha": "504dfe5dd47a1f0bf7aff3bc747c2a5e86fa08d1", "commit_message": "Add...
- def majority_filter(image, selem, out=None, mask=None, + def majority_filter(image, selem, out=None, mask=None, shift_x=False, ? +++++++++++++++ - shift_x=False, shift_y=False, n_bins=None): + shift_y=False): ...
Majority filter assign to each pixel the most occuring value within its neighborhood. Parameters ---------- image : ndarray Image array (uint8, uint16 array). selem : 2-D array The neighborhood expressed as a 2-D array of 1's and 0's. out : ndarray ...
false
false
skimage/filters/rank/generic.py
generic.py
scikit-image
scikit-image
Lib_tempfile.py
mkstemp
[ { "version": "v150", "docstring_lines": { "start_line": 86, "end_line": 92 }, "code_lines": { "start_line": 92, "end_line": 95 }, "commit_date_time": "2015-05-19 21:11:48", "commit_sha": "5d6b7b1cb7943255b8682ea3663ce2c0da500e96", "commit_message": "Issue #221...
- def mkstemp(suffix="", prefix=template, dir=None, text=False): ? ^^ ^^^^^^^ + def mkstemp(suffix=None, prefix=None, dir=None, text=False): ? ^^^^ ^^^ + prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir) - if dir is ...
User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. If 'suffix' is specified, the file name will end with that suffix, otherwise there will be no suffix. ...
false
false
Lib/tempfile.py
tempfile.py
cpython
python
Lib_tempfile.py
NamedTemporaryFile
[ { "version": "v90", "docstring_lines": { "start_line": 305, "end_line": 317 }, "code_lines": { "start_line": 317, "end_line": 335 }, "commit_date_time": "2008-02-28 22:21:11", "commit_sha": "36d1f8ec46b3f7982578381fb5378673c0456e43", "commit_message": "As Guid...
- def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None, ? ^ ---- ^^^^^ ^^ ^^^^ + def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", ? ^^^ ^^^^ ^ ^^ - newline=None, suffix="", prefix=template, -...
Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. - 'mode' -- the mode argument to io.open (default "w+b"). ? - + 'mode' -- the mode argument to os.fdopen (default "w+b"). ? + ++ + ...
false
false
Lib/tempfile.py
tempfile.py
cpython
python
python_ccxt_bybit.py
bybit.fetch_open_interest_history
[ { "version": "v299", "docstring_lines": { "start_line": 4846, "end_line": 4853 }, "code_lines": { "start_line": 4853, "end_line": 4905 }, "commit_date_time": "2022-11-24 12:33:26", "commit_sha": "50640e7740eab90ca3c4293997ee69e80154126c", "commit_message": "2....
def fetch_open_interest_history(self, symbol, timeframe='1h', since=None, limit=None, params={}): if timeframe == '1m': - raise BadRequest(self.id + ' fetchOpenInterestHistory() cannot use the 1m timeframe') ? - ...
- Gets the total amount of unsettled contracts. The total number of contracts held in open positions ? ^ + Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions ? ^^^...
false
false
python/ccxt/bybit.py
bybit.py
ccxt
ccxt
python_ccxt_bybit.py
bybit.borrow_margin
[ { "version": "v488", "docstring_lines": { "start_line": 8357, "end_line": 8366 }, "code_lines": { "start_line": 8366, "end_line": 8414 }, "commit_date_time": "2023-09-12 14:27:40", "commit_sha": "85386de44e95df1dbcd36f0842c3eba3a168fd2f", "commit_message": "Me...
def borrow_margin(self, code: str, amount, symbol: Optional[str] = None, params={}): self.load_markets() currency = self.currency(code) marginMode, query = self.handle_margin_mode_and_params('borrowMargin', params) if marginMode == 'isolated': ...
create a loan to borrow margin - see https://bybit-exchange.github.io/docs/spot/v3/#t-borrowmarginloan ? ------ ---------- + see https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow ? ...
false
false
python/ccxt/bybit.py
bybit.py
ccxt
ccxt
python_ccxt_bybit.py
bybit.fetch_currencies
[ { "version": "v364", "docstring_lines": { "start_line": 7001, "end_line": 7006 }, "code_lines": { "start_line": 7006, "end_line": 7039 }, "commit_date_time": "2023-02-24 10:49:05", "commit_sha": "440645d68988ec88677acf667d61d9a97ab94fcb", "commit_message": "2....
def fetch_currencies(self, params={}): if not self.check_required_credentials(False): return None - response = self.privateGetAssetV3PrivateCoinInfoQuery(params) ? --------- ---- + response = self.priva...
fetches all available currencies on an exchange + see https://bybit-exchange.github.io/docs/v5/asset/coin-info :param dict params: extra parameters specific to the bybit api endpoint :returns dict: an associative dictionary of currencies
false
false
python/ccxt/bybit.py
bybit.py
ccxt
ccxt
python_ccxt_bybit.py
bybit.fetch_deposits
[ { "version": "v502", "docstring_lines": { "start_line": 4535, "end_line": 4547 }, "code_lines": { "start_line": 4547, "end_line": 4624 }, "commit_date_time": "2023-10-03 09:17:16", "commit_sha": "7c047099de0563cf7b798f7d6874fa225b20a6e5", "commit_message": "4....
def fetch_deposits(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}): self.load_markets() + paginate = False + paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate') + ...
fetch all deposits made to an account see https://bybit-exchange.github.io/docs/v5/asset/deposit-record :param str code: unified currency code :param int [since]: the earliest time in ms to fetch deposits for, default = 30 days before the current time :param int [limit]: the ma...
false
false
python/ccxt/bybit.py
bybit.py
ccxt
ccxt
python_ccxt_bybit.py
bybit.fetch_order_trades
[ { "version": "v445", "docstring_lines": { "start_line": 5375, "end_line": 5384 }, "code_lines": { "start_line": 5384, "end_line": 5388 }, "commit_date_time": "2023-06-06 16:54:42", "commit_sha": "f7068e4f3c65fa51514a5f288925d618c19a96de", "commit_message": "3....
def fetch_order_trades(self, id: str, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}): - request = { + request = {} ? + + clientOrderId = self.safe_string_2(params, 'clientOrderId', 'orderLi...
fetch all the trades made from a single order :param str id: order id :param str|None symbol: unified market symbol :param int|None since: the earliest time in ms to fetch trades for :param int|None limit: the maximum number of trades to retrieve :param dict params: e...
false
false
python/ccxt/bybit.py
bybit.py
ccxt
ccxt