uid
stringlengths
24
24
split
stringclasses
1 value
category
stringclasses
2 values
content
stringlengths
5
482k
signature
stringlengths
1
14k
suffix
stringlengths
1
482k
prefix
stringlengths
9
14k
prefix_token_count
int64
3
5.01k
prefix_token_budget
int64
64
256
element_token_count
int64
1
292k
signature_token_count
int64
1
5.01k
prefix_context_token_count
int64
0
255
repo
stringlengths
7
112
path
stringlengths
4
208
language
stringclasses
1 value
name
stringlengths
1
218
qualname
stringlengths
1
218
start_line
int64
1
26.7k
end_line
int64
1
26.7k
signature_start_line
int64
1
26.7k
signature_end_line
int64
1
26.7k
source_hash
stringlengths
40
40
source_dataset
stringclasses
1 value
source_split
stringclasses
1 value
d2a980292ba6357a52c81b4d
train
function
@typemap def space_to_depth(operand, block_size, name=''): ''' Rearranges elements in the input tensor from the spatial dimensions to the depth dimension. This is the reverse transformation of depth_to_space. This operation is useful for implementing and testing sub-pixel convolution that is part of m...
@typemap def space_to_depth(operand, block_size, name=''):
''' Rearranges elements in the input tensor from the spatial dimensions to the depth dimension. This is the reverse transformation of depth_to_space. This operation is useful for implementing and testing sub-pixel convolution that is part of models for image super-resolution (see [1]). It rearrang...
by math:`(block_size \\times block_size)` name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` See also: [1] W. Shi et. al. `: Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convo...
179
179
598
17
162
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
space_to_depth
space_to_depth
4,028
4,073
4,028
4,029
fda49541500f5923c45d58f17766daeffbc7c511
bigcode/the-stack
train
77d98586897f00c130364801
train
function
@typemap def labels_to_graph(labels, name=''): ''' Conversion node from labels to graph. Typically used as an input to ForwardBackward node. This node's objective is to transform input labels into a graph representing exact forward-backward criterion. Example: >>> num_classes = 2 >>> la...
@typemap def labels_to_graph(labels, name=''):
''' Conversion node from labels to graph. Typically used as an input to ForwardBackward node. This node's objective is to transform input labels into a graph representing exact forward-backward criterion. Example: >>> num_classes = 2 >>> labels = C.input_variable((num_classes)) ...
k.ops.functions.Function` ''' from cntk.cntk_py import reconcile_dynamic_axes x = sanitize_input(x) dynamic_axes_as = sanitize_input(dynamic_axes_as) return reconcile_dynamic_axes(x, dynamic_axes_as, name) @typemap def labels_to_graph(labels, name=''):
64
64
150
13
51
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
labels_to_graph
labels_to_graph
242
261
242
243
aa687431147e767a38fd814feb1224d7b35d5679
bigcode/the-stack
train
c0e7dc87a80be7fdf55002ba
train
function
@typemap def cast(node_input, dtype, name=''): ''' cast input to dtype, with the same shape and dynamic axes. This function currently only support forward. Args: node_input: class:`~cntk.input_variable` that needs the dtype conversion dtype: data_type (np.float32, np.float64, np.float16...
@typemap def cast(node_input, dtype, name=''):
''' cast input to dtype, with the same shape and dynamic axes. This function currently only support forward. Args: node_input: class:`~cntk.input_variable` that needs the dtype conversion dtype: data_type (np.float32, np.float64, np.float16): data type of the converted output na...
operand = sanitize_input(operand, get_data_type(operand)) if not float(block_size).is_integer(): raise ValueError('block_size must be an integer.') return space_to_depth(operand, block_size, name) @typemap def cast(node_input, dtype, name=''):
64
64
167
14
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
cast
cast
4,075
4,090
4,075
4,076
eb7ef907930efeb8db88ddd7503de1e1b25ab207
bigcode/the-stack
train
0cf7e6e3bd048db5296eb753
train
function
@typemap def element_xor(x, y, name=''): ''' Computes the element-wise logic XOR of ``x`` and ``y``. Example: >>> C.element_xor([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 0., 1., 1., 0.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` tha...
@typemap def element_xor(x, y, name=''):
''' Computes the element-wise logic XOR of ``x`` and ``y``. Example: >>> C.element_xor([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 0., 1., 1., 0.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, opt...
:class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import element_or x = sanitize_input(x) y = sanitize_input(y) return element_or(x, y, name) @typemap def element_xor(x, y, name=''):
64
64
188
15
49
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_xor
element_xor
2,203
2,221
2,203
2,204
1d3bfb45df761a5f611bcca6bd7853581b78a46f
bigcode/the-stack
train
1dfeb4e3273339943bfc8a50
train
function
@typemap def sqrt(x, name=''): ''' Computes the element-wise square-root of ``x``: :math:`sqrt(x) = {\sqrt[2]{x}}` Example: >>> C.sqrt([0., 4.]).eval() array([ 0., 2.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor ...
@typemap def sqrt(x, name=''):
''' Computes the element-wise square-root of ``x``: :math:`sqrt(x) = {\sqrt[2]{x}}` Example: >>> C.sqrt([0., 4.]).eval() array([ 0., 2.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): t...
this is the only guaranteed precision across platforms. This will be changed to return `NaN` and `-inf`. ''' from cntk.cntk_py import log x = sanitize_input(x) return log(x, name) @typemap def sqrt(x, name=''):
64
64
181
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
sqrt
sqrt
2,077
2,100
2,077
2,078
d7603a35df8f3778d811019eab6a263b37028f67
bigcode/the-stack
train
79ef170183a0bec267e81ac7
train
function
@typemap def reciprocal(x, name=''): ''' Computes the element-wise reciprocal of ``x``: Example: >>> C.reciprocal([-1/3, 1/5, -2, 3]).eval() array([-3. , 5. , -0.5 , 0.333333], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that...
@typemap def reciprocal(x, name=''):
''' Computes the element-wise reciprocal of ``x``: Example: >>> C.reciprocal([-1/3, 1/5, -2, 3]).eval() array([-3. , 5. , -0.5 , 0.333333], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, ...
optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import negate x = sanitize_input(x) return negate(x, name) @typemap def reciprocal(x, name=''):
64
64
165
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reciprocal
reciprocal
2,245
2,262
2,245
2,246
6f8136d873e5867802431d645967f8d53ff979ef
bigcode/the-stack
train
13ac7ff4200982e95b897895
train
function
def _input_spec(shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], name=''): ''' We need _input_spec because input is python built-in and because of typemap, must remain in sync with input. TODO: Investigate to r...
def _input_spec(shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], name=''):
''' We need _input_spec because input is python built-in and because of typemap, must remain in sync with input. TODO: Investigate to remove it. ''' pass
, name) ########################################################################## # variables_and_parameters ops ########################################################################## from cntk.device import use_default_device from cntk.axis import Axis def _input_spec(shape, dtype=default_override_or(np.float32...
64
64
78
35
28
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
_input_spec
_input_spec
3,613
3,620
3,613
3,614
f0a7caf03e30eb88b35c3e4a080364099d4f44a5
bigcode/the-stack
train
822823d4facf90f176beb8da
train
function
@typemap def to_sequence_like(x, dynamic_axes_like, name=''): ''' This function converts 'x' to a sequence using the most significant static axis [0] as the sequence axis. The length of the sequences are obtained from the 'dynamic_axes_like' operand. Args: x: the tensor (or its name) which ...
@typemap def to_sequence_like(x, dynamic_axes_like, name=''):
''' This function converts 'x' to a sequence using the most significant static axis [0] as the sequence axis. The length of the sequences are obtained from the 'dynamic_axes_like' operand. Args: x: the tensor (or its name) which is converted to a sequence dynamic_axes_like: Tensor o...
if sequence_lengths is None: return to_sequence(x, sequence_axis_name_prefix, name) else: sequence_lengths = sanitize_input(sequence_lengths) return to_sequence(x, sequence_lengths, sequence_axis_name_prefix, name) @typemap def to_sequence_like(x, dynamic_axes_like, name=''):
64
64
210
17
47
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
to_sequence_like
to_sequence_like
3,432
3,457
3,432
3,433
76495a646c47a2aa9e9239f028ab64238dcb718a
bigcode/the-stack
train
7d77f6cc8197fc87a32d8004
train
function
@typemap def element_divide(left, right, name=''): ''' The output of this operation is the element-wise division of the two input tensors. It supports broadcasting. Example: >>> C.element_divide([1., 1., 1., 1.], [0.5, 0.25, 0.125, 0.]).eval() array([ 2., 4., 8., 0.], dtype=float32) ...
@typemap def element_divide(left, right, name=''):
''' The output of this operation is the element-wise division of the two input tensors. It supports broadcasting. Example: >>> C.element_divide([1., 1., 1., 1.], [0.5, 0.25, 0.125, 0.]).eval() array([ 2., 4., 8., 0.], dtype=float32) >>> C.element_divide([5., 10., 15., 30.], ...
.Function` ''' from cntk.cntk_py import element_min as cntk_py_element_min dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return cntk_py_element_min(left, right, name) @typemap def element_divide(left, right, name=''):
78
78
262
15
63
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_divide
element_divide
1,062
1,086
1,062
1,063
ff306b2420388bce088e4b3c17594c1d4de49026
bigcode/the-stack
train
f3773a6eebcabb8c0a7b6563
train
function
@typemap def unpooling(operand, pooling_input, unpooling_type, unpooling_window_shape, strides=(1,), auto_padding=[False], name=''): ''' Unpools the ``operand`` using information from ``pooling_input``. Unpooling mirrors the operations performed by pooling and depends on the values provided to...
@typemap def unpooling(operand, pooling_input, unpooling_type, unpooling_window_shape, strides=(1,), auto_padding=[False], name=''):
''' Unpools the ``operand`` using information from ``pooling_input``. Unpooling mirrors the operations performed by pooling and depends on the values provided to the corresponding pooling operation. The output should have the same shape as pooling_input. Pooling the result of an unpooling operation shou...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import pooling operand = sanitize_input(operand) pooling_window_shape, strides, auto_padding = sanitize_pooling_args(pooling_window_shape, strides, auto_padding) return pooling(operand, pooling_type, pooling_window_sha...
148
148
495
38
110
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
unpooling
unpooling
572
607
572
574
f5060dfde1e82454d6be18b8fb7bf452d4bbf9bd
bigcode/the-stack
train
503a38867be1270bf2c83dfd
train
function
@typemap def input_variable(shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], name=''): ''' input_variable(shape, dtype=np.float32, needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], nam...
@typemap def input_variable(shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], name=''):
''' input_variable(shape, dtype=np.float32, needs_gradient=False, is_sparse=False, dynamic_axes=[Axis.default_batch_axis()], name='') It creates an input in the network: a place where data, such as features and labels, should be provided. Args: shape (tuple or int): the shape of the input ...
Returns: :class:`~cntk.variables.Variable` ''' import warnings warnings.warn('This will be removed in future versions. Please use ' 'input_variable() instead.', DeprecationWarning) return input_variable(shape, dtype, needs_gradient, is_sparse, dynamic_axes, name) @typema...
104
104
349
38
66
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
input_variable
input_variable
3,648
3,681
3,648
3,650
998577a23eb1da066267efda4795243a980fef40
bigcode/the-stack
train
49daacf979f8bd605a6ef7a6
train
function
@associative_multi_arg @typemap def element_max(left, right, name=''): ''' The output of this operation is the element-wise max of the two or more input tensors. It supports broadcasting. Args: arg1: left side tensor arg2: right side tensor *more_args: additional inputs ...
@associative_multi_arg @typemap def element_max(left, right, name=''):
''' The output of this operation is the element-wise max of the two or more input tensors. It supports broadcasting. Args: arg1: left side tensor arg2: right side tensor *more_args: additional inputs name (str, optional): the name of the Function instance in the network ...
_times dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return cntk_py_element_times(left, right, name) @associative_multi_arg @typemap def element_max(left, right, name=''):
64
64
167
21
43
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_max
element_max
1,020
1,039
1,020
1,022
037ceca2113ed8a4d2c7cdbd7350e5f2318a6994
bigcode/the-stack
train
f5f5a66cf04645ce154a9249
train
function
@typemap def crop_automatic(node_input, node_referent, name = ''): ''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are computed by traversing the network graph and computing affine transform between the two inputs. Translation part of the transf...
@typemap def crop_automatic(node_input, node_referent, name = ''):
''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are computed by traversing the network graph and computing affine transform between the two inputs. Translation part of the transform determines the offsets. The transform is computed as compos...
= sanitize_input(node_input, get_data_type(node_input)) arg_ref = sanitize_input(node_referent, get_data_type(node_referent)) return crop(arg_input, arg_ref, offset_x, offset_y, name) @typemap def crop_automatic(node_input, node_referent, name = ''):
69
69
233
20
49
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
crop_automatic
crop_automatic
3,931
3,951
3,931
3,932
0400b3a5666f3f5f8b74c6907f439f127c6e60bd
bigcode/the-stack
train
32bcc8840422ae2f5b11af67
train
function
@typemap def atanh(x, name=''): ''' Computes the element-wise atanh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.atanh([[0.9,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.47222, 0.54931], [-0.25541, -0.97296]], dtype=float32) Args: ...
@typemap def atanh(x, name=''):
''' Computes the element-wise atanh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.atanh([[0.9,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.47222, 0.54931], [-0.25541, -0.97296]], dtype=float32) Args: x: numpy array or any :cl...
name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import tanh x = sanitize_input(x) return tanh(x, name) @typemap def atanh(x, name=''):
64
64
189
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
atanh
atanh
1,660
1,680
1,660
1,661
d832f8982ba7ee285e29abc4208fc30ac3f7c264
bigcode/the-stack
train
ba1070f35f344a301e9c6708
train
function
@typemap def asinh(x, name=''): ''' Computes the element-wise asinh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.asinh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 0.88137, 0.48121], [-0.24747, -0.69315]], dtype=float32) Args: ...
@typemap def asinh(x, name=''):
''' Computes the element-wise asinh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.asinh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 0.88137, 0.48121], [-0.24747, -0.69315]], dtype=float32) Args: x: numpy array or any :clas...
name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import cosh x = sanitize_input(x) return cosh(x, name) @typemap def asinh(x, name=''):
64
64
187
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
asinh
asinh
1,856
1,876
1,856
1,857
8976b3092cb2f5a4b3fa8d9845736abeccccea8f
bigcode/the-stack
train
a02e765426ad2a2ab58c6c78
train
function
@typemap def asin(x, name=''): ''' Computes the element-wise arcsin (inverse sine) of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.asin([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.5708 , 0.5236 ], [-0.25268, -0.84806]], dtype=float32) ...
@typemap def asin(x, name=''):
''' Computes the element-wise arcsin (inverse sine) of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.asin([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.5708 , 0.5236 ], [-0.25268, -0.84806]], dtype=float32) Args: x: numpy arr...
optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import acos x = sanitize_input(x) return acos(x, name) @typemap def asin(x, name=''):
64
64
188
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
asin
asin
1,769
1,789
1,769
1,770
b2588d62127b505df07cf2459f1a13eac4a8f559
bigcode/the-stack
train
b72ea0cb954b911a804b403e
train
function
def associative_multi_arg(f): ''' The output of this operation is the result of an operation (`plus`, `log_add_exp`, `element_times`, `element_max`, `element_min`) of two or more input tensors. Broadcasting is supported. Example: >>> C.plus([1, 2, 3], [4, 5, 6]).eval() array([ 5., 7., ...
def associative_multi_arg(f):
''' The output of this operation is the result of an operation (`plus`, `log_add_exp`, `element_times`, `element_max`, `element_min`) of two or more input tensors. Broadcasting is supported. Example: >>> C.plus([1, 2, 3], [4, 5, 6]).eval() array([ 5., 7., 9.], dtype=float32) ...
1., 0.], dtype=float32) >>> C.less_equal([-1,0,1], [0]).eval() array([ 1., 1., 0.], dtype=float32) Args: left: left side tensor right: right side tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functi...
187
187
626
6
181
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
associative_multi_arg
associative_multi_arg
850
894
850
850
a1df2acbda9dcd0a928712a421ae3a813990ac26
bigcode/the-stack
train
c829e834274e020c19b955d5
train
function
@typemap def reduce_prod(x, axis=None, keepdims=True, name=''): ''' Computes the min of the input tensor's elements across the specified axis. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1],...
@typemap def reduce_prod(x, axis=None, keepdims=True, name=''):
''' Computes the min of the input tensor's elements across the specified axis. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=np.float32) >>> C.reduce_prod(data, 0)...
of :class:`~cntk.axis.Axis`): axis along which the reduction will be performed keepdims (boolean): Keep the reduced dimension or not, default True mean keep reduced dimension name (str): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` N...
149
149
497
19
130
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_prod
reduce_prod
3,191
3,232
3,191
3,192
6e120208f930469aebf397cf492ad912abe2cd76
bigcode/the-stack
train
b7c2a21a7ebac7a4548f4aa1
train
function
@typemap def gather(reference, indices, axis=None, name=''): ''' Retrieves the elements of indices in the tensor reference. Example: >>> c = np.asarray([[[0],[1]],[[4],[5]]]).astype('f') >>> x = C.input_variable((2,1)) >>> d = np.arange(12).reshape(6,2).astype('f') >>> y = C...
@typemap def gather(reference, indices, axis=None, name=''):
''' Retrieves the elements of indices in the tensor reference. Example: >>> c = np.asarray([[[0],[1]],[[4],[5]]]).astype('f') >>> x = C.input_variable((2,1)) >>> d = np.arange(12).reshape(6,2).astype('f') >>> y = C.constant(d) >>> C.gather(y, x).eval({x:c}) a...
inner-most axis). name (str, optional, keyword only): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import one_hot_op x = sanitize_input(x) axis = sanitize_axis(axis) return one_hot_op(x, num_classes, spars...
100
100
335
16
84
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
gather
gather
2,878
2,915
2,878
2,879
d02e278da5ee311ecbd8cd0b2c0a79906c5dea87
bigcode/the-stack
train
33c7e6283153a964a1080179
train
function
@typemap def negate(x, name=''): ''' Computes the element-wise negation of ``x``: :math:`negate(x) = -x` Example: >>> C.negate([-1, 1, -2, 3]).eval() array([ 1., -1., 2., -3.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a...
@typemap def negate(x, name=''):
''' Computes the element-wise negation of ``x``: :math:`negate(x) = -x` Example: >>> C.negate([-1, 1, -2, 3]).eval() array([ 1., -1., 2., -3.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, option...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import element_xor x = sanitize_input(x) y = sanitize_input(y) return element_xor(x, y, name) @typemap def negate(x, name=''):
64
64
163
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
negate
negate
2,223
2,242
2,223
2,224
b60733f8883cec4f317b3ecc751f65365146a437
bigcode/the-stack
train
8a2bab0311a2e863e4cf0695
train
function
@typemap def reduce_sum(x, axis=None, keepdims=True, name=''): ''' Computes the sum of the input tensor's elements across one axis or a list of axes. If the axis parameter is not specified then the sum will be computed over all static axes, which is equivalent with specifying ``axis=Axis.all_static_axes...
@typemap def reduce_sum(x, axis=None, keepdims=True, name=''):
''' Computes the sum of the input tensor's elements across one axis or a list of axes. If the axis parameter is not specified then the sum will be computed over all static axes, which is equivalent with specifying ``axis=Axis.all_static_axes()``. If ``axis=Axis.all_axes()`` is specified, then the ou...
., 16., 17., 18., 19., 20., 21., 22., 23.]], dtype=float32) Args: x: Input tensor. axis (int): (Default to 0) Indicates up to which input dimensions (exclusive) should be flattened to the outer dimension of the output name (str, optional): the name of the Function in...
189
189
633
19
170
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_sum
reduce_sum
2,953
3,001
2,953
2,954
651b9fae3640cee6ffec85e5b33d3bc0374f8061
bigcode/the-stack
train
7f53598639e094d75dc9f77f
train
function
@typemap def reduce_max(x, axis=None, keepdims=True, name=''): ''' Computes the max of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],...
@typemap def reduce_max(x, axis=None, keepdims=True, name=''):
''' Computes the max of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=np.float32) ...
.axis.Axis`): axis along which the reduction will be performed keepdims (boolean): Keep the reduced dimension or not, default True mean keep reduced dimension name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` Note tha...
147
147
491
19
128
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_max
reduce_max
3,103
3,144
3,103
3,104
6f67696f9884523068536960650e95b99d86fbf4
bigcode/the-stack
train
215dd129f5abb9c8641296ea
train
function
@typemap def combine(*operands, **kw_name): ''' Create a new Function instance which just combines the outputs of the specified list of 'operands' Functions such that the 'Outputs' of the new 'Function' are union of the 'Outputs' of each of the specified 'operands' Functions. E.g., when creating a cl...
@typemap def combine(*operands, **kw_name):
''' Create a new Function instance which just combines the outputs of the specified list of 'operands' Functions such that the 'Outputs' of the new 'Function' are union of the 'Outputs' of each of the specified 'operands' Functions. E.g., when creating a classification model, typically the Cross...
_permutation, sanitize_dtype_cntk from cntk.internal.utils import get_data_type from ..axis import Axis from .. import cntk_py from ..cntk_py import sentinel_value_for_auto_select_random_seed as SentinelValueForAutoSelectRandomSeed from ..default_options import get_default_override, default_override_or TIMES_NO_INFERR...
175
175
584
14
160
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
combine
combine
30
82
30
31
73a6d395054d597b92b75ba5e40a1ec5bbfa1723
bigcode/the-stack
train
fb972d255a90bf95fc90456c
train
function
@typemap def reduce_min(x, axis=None, keepdims=True, name=''): ''' Computes the min of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],...
@typemap def reduce_min(x, axis=None, keepdims=True, name=''):
''' Computes the min of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=np.float32) ...
.Axis`): axis along which the reduction will be performed keepdims (boolean): Keep the reduced dimension or not, default True mean keep reduced dimension name (str): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` Note that CNTK keeps the...
144
144
483
19
125
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_min
reduce_min
3,147
3,188
3,147
3,148
4f94c9a2fd68371619ecc7ac29dc94b28dbb0bf7
bigcode/the-stack
train
1d4d73a038f9d7cd541339fe
train
function
@typemap def slice(x, axis, begin_index, end_index, strides=None, name=''): ''' Slice the input along one or multiple axes. Example: >>> # slice using input variable >>> # create 2x3 matrix >>> x1 = C.input_variable((2,3)) >>> # slice index 1 (second) at first axis >...
@typemap def slice(x, axis, begin_index, end_index, strides=None, name=''):
''' Slice the input along one or multiple axes. Example: >>> # slice using input variable >>> # create 2x3 matrix >>> x1 = C.input_variable((2,3)) >>> # slice index 1 (second) at first axis >>> C.slice(x1, 0, 1, 2).eval({x1: np.asarray([[[1,2,-3], ... ...
5., 5., 4.]], dtype=float32) Args: x: tensor to be padded. pattern (list of tuple with 2 integers): how many values to add before and after the contents of the tensor in each dimension. mode (int): padding mode: C.ops.CONSTANT_PAD, C.ops.REFLECT_PAD and C.ops.SYMMETRIC_PAD constan...
256
256
1,102
22
234
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
slice
slice
2,657
2,743
2,657
2,658
48cabf3fd84811d2d6d79ec0a53c927a2fdf86b3
bigcode/the-stack
train
14694d31106a57030f20f468
train
function
@typemap def squeeze(x, axes=None, name=''): ''' Removes axes whose size is 1. If ``axes`` is specified, and any of their size is not 1 an exception will be raised. Example: >>> x0 = np.arange(12).reshape((2, 2, 1, 3)).astype('f') >>> x = C.input_variable((2, 1, 3)) >>>...
@typemap def squeeze(x, axes=None, name=''):
''' Removes axes whose size is 1. If ``axes`` is specified, and any of their size is not 1 an exception will be raised. Example: >>> x0 = np.arange(12).reshape((2, 2, 1, 3)).astype('f') >>> x = C.input_variable((2, 1, 3)) >>> C.squeeze(x).eval({x: x0}) array([[[...
Axis(0)): return Axis.new_leading_axis() else: return Axis(-axis.static_axis_index()) internal_reshape_begin_axis = sanitize_reshape_axis(end_axis) internal_reshape_end_axis = sanitize_reshape_axis(begin_axis) return reshape(x, shape, internal_reshape_begin_axis, internal_...
87
87
290
14
73
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
squeeze
squeeze
2,498
2,528
2,498
2,499
6c1dd2a62dc68594ebc8ffde4c82af4bd6485f46
bigcode/the-stack
train
aaf5da66b0b83f89b39ade27
train
function
@typemap def crop_automatic_with_ancestors(node_input, node_referent, ancestor_input, ancestor_referent, name = ''): ''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are computed by traversing the network graph and computing affine transform betw...
@typemap def crop_automatic_with_ancestors(node_input, node_referent, ancestor_input, ancestor_referent, name = ''):
''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are computed by traversing the network graph and computing affine transform between the two inputs. Translation part of the transform determines the offsets. The transform is computed as compos...
class:`~cntk.ops.functions.Function` that outputs the reference tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import crop arg_input = sanitize_input(node_input, get_data_type(node_input)...
137
137
457
32
105
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
crop_automatic_with_ancestors
crop_automatic_with_ancestors
3,953
3,983
3,953
3,954
b6eeb61739c473613d7ed1a1e0306b1ac5a78adc
bigcode/the-stack
train
eb4d28f333b8abe8a01049f1
train
function
@typemap def as_block(composite, block_arguments_map, block_op_name, block_instance_name=''): ''' Create a new block Function instance which just encapsulates the specified composite Function to create a new Function that appears to be a primitive. All the arguments of the composite being encapsulate...
@typemap def as_block(composite, block_arguments_map, block_op_name, block_instance_name=''):
''' Create a new block Function instance which just encapsulates the specified composite Function to create a new Function that appears to be a primitive. All the arguments of the composite being encapsulated must be Placeholder variables. The purpose of block Functions is to enable creation of ...
operands) operands_unfold = [] for o in operands: if hasattr(o, 'outputs') and len(o.outputs) > 1: operands_unfold += o.outputs else: operands_unfold += [o] return sum(operands_unfold, name) @typemap def as_block(composite, block_arguments_map, block_op_name, block_in...
85
85
284
23
62
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
as_block
as_block
154
178
154
155
56c2926153166c9f6c6706f3f30941de0fc74a64
bigcode/the-stack
train
0fc8f9bffe550b4c23e150fd
train
function
@typemap def softmax(x, axis=None, name=''): r''' Computes the gradient of :math:`f(z)=\log\sum_i\exp(z_i)` at ``z = x``. Concretely, :math:`\mathrm{softmax}(x)=\left[\frac{\exp(x_1)}{\sum_i\exp(x_i)}\quad\frac{\exp(x_1)}{\sum_i\exp(x_i)}\quad\ldots\quad\frac{\exp(x_1)}{\sum_i\exp(x_i)}\right]` with t...
@typemap def softmax(x, axis=None, name=''):
r''' Computes the gradient of :math:`f(z)=\log\sum_i\exp(z_i)` at ``z = x``. Concretely, :math:`\mathrm{softmax}(x)=\left[\frac{\exp(x_1)}{\sum_i\exp(x_i)}\quad\frac{\exp(x_1)}{\sum_i\exp(x_i)}\quad\ldots\quad\frac{\exp(x_1)}{\sum_i\exp(x_i)}\right]` with the understanding that the implementation can ...
this can be faster (one reduce pass instead of two), but can behave slightly differently numerically. Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor axis (int): axis along which the logsoftmax operation will be performed (the default is the last axis) ...
174
174
582
15
159
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
softmax
softmax
1,902
1,948
1,902
1,903
f6a94f9390729b21416bc537486bcba21280c38c
bigcode/the-stack
train
a3e4b7c49d683c9920d6f5f1
train
function
@typemap def crop_manual(node_input, node_referent, offset_x, offset_y, name = ''): ''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are given in pixels. Args: node_input: class:`~cntk.ops.functions.Function` that outputs the tensor to be...
@typemap def crop_manual(node_input, node_referent, offset_x, offset_y, name = ''):
''' Crops input along spatial dimensions so that it matches spatial size of reference input. Crop offsets are given in pixels. Args: node_input: class:`~cntk.ops.functions.Function` that outputs the tensor to be cropped node_referent: class:`~cntk.ops.functions.Function` that outputs th...
assign dtype = get_data_type(input) operand = sanitize_input(input, dtype) ref_operand = sanitize_input(ref, dtype) return assign(ref_operand, operand, name) @typemap def crop_manual(node_input, node_referent, offset_x, offset_y, name = ''):
64
64
213
25
39
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
crop_manual
crop_manual
3,911
3,929
3,911
3,912
017a36decd95404f3a3e126b599dce8b46508f9b
bigcode/the-stack
train
d5a65436fcc40d700912cdfa
train
function
@typemap def abs(x, name=''): ''' Computes the element-wise absolute of ``x``: :math:`abs(x) = |x|` Example: >>> C.abs([-1, 1, -2, 3]).eval() array([ 1., 1., 2., 3.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor ...
@typemap def abs(x, name=''):
''' Computes the element-wise absolute of ``x``: :math:`abs(x) = |x|` Example: >>> C.abs([-1, 1, -2, 3]).eval() array([ 1., 1., 2., 3.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): ...
optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import square x = sanitize_input(x) return square(x, name) @typemap def abs(x, name=''):
64
64
163
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
abs
abs
2,123
2,142
2,123
2,124
5e465b54e48c7e7d8cd01af68534f77f59ebc7b9
bigcode/the-stack
train
122d03c2ce5d0a3ef3bcebae
train
function
@typemap def floor(arg, name=''): ''' The output of this operation is the element wise value rounded to the largest integer less than or equal to the input. Example: >>> C.floor([0.2, 1.3, 4., 5.5, 0.0]).eval() array([ 0., 1., 4., 5., 0.], dtype=float32) >>> C.floor([[0.6, ...
@typemap def floor(arg, name=''):
''' The output of this operation is the element wise value rounded to the largest integer less than or equal to the input. Example: >>> C.floor([0.2, 1.3, 4., 5.5, 0.0]).eval() array([ 0., 1., 4., 5., 0.], dtype=float32) >>> C.floor([[0.6, 3.3], [1.9, 5.6]]).eval() ...
ntk_py import times_transpose dtype = get_data_type(left, right) left = sanitize_input(left, dtype) rshape = sanitize_shape(right.shape) right = sanitize_input(right, dtype, (1,rshape[0]) if len(rshape) == 1 else None) return times_transpose(right, left, 1, name) ###################################...
97
97
325
11
86
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
floor
floor
1,279
1,308
1,279
1,280
a100cea63af62c8151f452cd97a2f6f2bdeb2841
bigcode/the-stack
train
083858cb13f0e35c550cd8d2
train
function
@typemap def expand_dims(x, axis, name=''): ''' Adds a singleton (size 1) axis at position ``axis``. Example: >>> x0 = np.arange(12).reshape((2, 2, 3)).astype('f') >>> x = C.input_variable((2, 3)) >>> C.expand_dims(x, 0).eval({x: x0}) array([[[[ 0., 1., 2.]], ...
@typemap def expand_dims(x, axis, name=''):
''' Adds a singleton (size 1) axis at position ``axis``. Example: >>> x0 = np.arange(12).reshape((2, 2, 3)).astype('f') >>> x = C.input_variable((2, 3)) >>> C.expand_dims(x, 0).eval({x: x0}) array([[[[ 0., 1., 2.]], <BLANKLINE> [[ 3., 4., ...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import squeeze x = sanitize_input(x) if axes is None: return squeeze(x, name) else: axes = sanitize_axis_list(axes) return squeeze(x, axes, name) @typemap def expand_dims(x, axis, name=''):
81
81
270
14
67
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
expand_dims
expand_dims
2,531
2,560
2,531
2,532
7be12ab3b028cd12dda2ca9368ad5373767c5244
bigcode/the-stack
train
8e184ad0dfd3496fc136e3dc
train
function
@typemap def clip(x, min_value, max_value, name=''): ''' Computes a tensor with all of its values clipped to fall between ``min_value`` and ``max_value``, i.e. ``min(max(x, min_value), max_value)``. The output tensor has the same shape as ``x``. Example: >>> C.clip([1., 2.1, 3.0, 4.1],...
@typemap def clip(x, min_value, max_value, name=''):
''' Computes a tensor with all of its values clipped to fall between ``min_value`` and ``max_value``, i.e. ``min(max(x, min_value), max_value)``. The output tensor has the same shape as ``x``. Example: >>> C.clip([1., 2.1, 3.0, 4.1], 2., 4.).eval() array([ 2. , 2.1, 3. , 4. ...
-3.]], dtype=float32) Args: arg: input tensor name (str, optional): the name of the Function instance in the network (optional) Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import round arg = sanitize_input(arg, get_data_type(arg)) return round(a...
110
110
369
17
93
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
clip
clip
1,375
1,405
1,375
1,376
b2759ec52862afee035f664544e1e078d7c28dee
bigcode/the-stack
train
e84764449dffc46a26439a9c
train
function
@typemap def image_scaler(x, scalar, biases, name=''): ''' Alteration of image by scaling its individual values. Args: x (`numpy.array` or :class:`~cntk.ops.functions.Function`): any :class:`~cntk.ops.functions.Function` that outputs a tensor. scalar (float): Scalar channel factor. ...
@typemap def image_scaler(x, scalar, biases, name=''):
''' Alteration of image by scaling its individual values. Args: x (`numpy.array` or :class:`~cntk.ops.functions.Function`): any :class:`~cntk.ops.functions.Function` that outputs a tensor. scalar (float): Scalar channel factor. bias (numpy array): Bias values for each channel. ...
''' from cntk.cntk_py import reduce_sum_square x = sanitize_input(x) axis = sanitize_multi_axis_reduction_list(axis) return reduce_sum_square(x, axis, keepdims, name) @typemap def image_scaler(x, scalar, biases, name=''):
64
64
147
17
47
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
image_scaler
image_scaler
3,313
3,329
3,313
3,314
18462cdf2a7197f8e92f271626fbe34059eb7e85
bigcode/the-stack
train
ed4269f4b1edfc989e373627
train
function
@typemap def splice(*inputs, **kw_axis_name): ''' Concatenate the input tensors along an axis. Example: >>> # create 2x2 matrix in a sequence of length 1 in a batch of one sample >>> data1 = np.asarray([[[1, 2], ... [4, 5]]], dtype=np.float32) >>> x = C...
@typemap def splice(*inputs, **kw_axis_name):
''' Concatenate the input tensors along an axis. Example: >>> # create 2x2 matrix in a sequence of length 1 in a batch of one sample >>> data1 = np.asarray([[[1, 2], ... [4, 5]]], dtype=np.float32) >>> x = C.constant(value=data1) >>> # create 3x...
Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import slice x = sanitize_input(x) axis = sanitize_axis_list(axis) begin_index = sanitize_shape(begin_index) end_index = sanitize_shape(end_index) if strides is None: strides = [1 for _ in axis] elif no...
137
138
460
14
123
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
splice
splice
2,748
2,791
2,748
2,749
fd04cb645eb1a5dcf6ecb88957bb027e824914dd
bigcode/the-stack
train
014d72c4d0d71140f394405f
train
function
@typemap def sinh(x, name=''): ''' Computes the element-wise sinh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.sinh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.1752 , 0.5211 ], [-0.25261, -0.82232]], dtype=float32) Args: ...
@typemap def sinh(x, name=''):
''' Computes the element-wise sinh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.sinh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.1752 , 0.5211 ], [-0.25261, -0.82232]], dtype=float32) Args: x: numpy array or any :class:...
optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import atan x = sanitize_input(x) return atan(x, name) @typemap def sinh(x, name=''):
64
64
183
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
sinh
sinh
1,812
1,832
1,812
1,813
bcdf8f6228a0764448bf6c8ce7e010d885642a4f
bigcode/the-stack
train
bb0e0086c227f8b2890fc289
train
function
@typemap def reduce_l1(x, axis=None, keepdims = True, name=''): ''' Computes the L1 norm of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pruned. ...
@typemap def reduce_l1(x, axis=None, keepdims = True, name=''):
''' Computes the L1 norm of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pruned. Example: >>> C.reduce_l1([[[1,2], [3,4]],[[5,6], [7,8]],...
:class:`~cntk.ops.functions.Function` Note that CNTK keeps the shape of the resulting tensors when reducing over multiple static axes. ''' from cntk.cntk_py import reduce_prod x = sanitize_input(x) axis = sanitize_multi_axis_reduction_list(axis) return reduce_prod(x, axis, keepdims, name) @typ...
95
95
317
21
74
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_l1
reduce_l1
3,234
3,259
3,234
3,235
eaaf96f785165928605d55af912e90c28bb5b84e
bigcode/the-stack
train
881fae991eddf3a79d0e937c
train
function
@typemap def batch_normalization(operand, scale, bias, running_mean, running_inv_std, spatial, normalization_time_constant=5000, blend_time_constant=0, epsilon=0.00001, use_cudnn_engine=False, disable_regularization=False, name='', running_count=None): # TODO: running...
@typemap def batch_normalization(operand, scale, bias, running_mean, running_inv_std, spatial, normalization_time_constant=5000, blend_time_constant=0, epsilon=0.00001, use_cudnn_engine=False, disable_regularization=False, name='', running_count=None): # TODO: running...
''' Normalizes layer outputs for every minibatch for each output (feature) independently and applies affine transformation to preserve representation of the layer. Args: operand: input of the batch normalization operation scale: parameter tensor that holds the learned componentwise-scal...
class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import unpooling operand = sanitize_input(operand) pooling_input = sanitize_input(pooling_input) unpooling_window_shape, strides, auto_padding = sanitize_pooling_args(unpooling_window_shape, strides, auto_padding) return unpooling(operan...
183
183
611
84
99
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
batch_normalization
batch_normalization
610
655
610
614
c4d2c6e21f120c2649fd0a7fa66f551603fdf5a6
bigcode/the-stack
train
d185be9e55d2fc9b7a6e5bb6
train
function
@typemap def reduce_log_sum_exp(x, axis=None, keepdims=True, name=''): ''' Computes the log of the sum of the exponentiations of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample...
@typemap def reduce_log_sum_exp(x, axis=None, keepdims=True, name=''):
''' Computes the log of the sum of the exponentiations of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1],...
:class:`~cntk.axis.Axis` or a :obj:`list` or :obj:`tuple` of int or :class:`~cntk.axis.Axis`): axis along which the reduction will be performed keepdims (boolean): Keep the reduced dimension or not, default True mean keep reduced dimension name (str, optional): the name of the Function instance in the ...
180
180
602
21
159
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_log_sum_exp
reduce_log_sum_exp
3,004
3,049
3,004
3,005
72da588ced6d8bad65f63e3f71bdf9de949e90b2
bigcode/the-stack
train
44e959e602a8b596243199d4
train
function
@typemap def per_dim_mean_variance_normalize(operand, mean, inv_stddev, name=''): ''' Computes per dimension mean-variance normalization of the specified input operand. Args: operand: the variable to be normalized mean (NumPy array): per dimension mean to use for the normalization i...
@typemap def per_dim_mean_variance_normalize(operand, mean, inv_stddev, name=''):
''' Computes per dimension mean-variance normalization of the specified input operand. Args: operand: the variable to be normalized mean (NumPy array): per dimension mean to use for the normalization inv_stddev (NumPy array): per dimension standard deviation to use for the normaliza...
..variables import Constant return Constant(value, shape, dtype, device, name) ########################################################################## # normalization ops ########################################################################## # TODO: ComputeInputPerDimMeansAndInvStdDevs @typemap def per_di...
64
64
187
24
39
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
per_dim_mean_variance_normalize
per_dim_mean_variance_normalize
3,809
3,825
3,809
3,810
30aa5f13d6212bbfdd4fe4fcf60a80d7e437f7d9
bigcode/the-stack
train
101c41997ac6d7a06b32b173
train
function
@typemap def element_and(x, y, name=''): ''' Computes the element-wise logic AND of ``x``. Example: >>> C.element_and([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 1., 0., 0., 0.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a t...
@typemap def element_and(x, y, name=''):
''' Computes the element-wise logic AND of ``x``. Example: >>> C.element_and([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 1., 0., 0., 0.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the n...
name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import abs x = sanitize_input(x) return abs(x, name) @typemap def element_and(x, y, name=''):
64
64
178
14
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_and
element_and
2,144
2,162
2,144
2,145
0508e4082798f13b736cb3e6030fa309a5c2922d
bigcode/the-stack
train
e969bd20a0b826bc3e37c579
train
function
@typemap def swapaxes(x, axis1=0, axis2=1, name=''): ''' Swaps two axes of the tensor. The output tensor has the same data but with ``axis1`` and ``axis2`` swapped. Example: >>> C.swapaxes([[[0,1],[2,3],[4,5]]], 1, 2).eval() array([[[ 0., 2., 4.], [ 1., 3., 5.]]], dt...
@typemap def swapaxes(x, axis1=0, axis2=1, name=''):
''' Swaps two axes of the tensor. The output tensor has the same data but with ``axis1`` and ``axis2`` swapped. Example: >>> C.swapaxes([[[0,1],[2,3],[4,5]]], 1, 2).eval() array([[[ 0., 2., 4.], [ 1., 3., 5.]]], dtype=float32) Args: x: tensor to be trans...
_input(x) if type(perm) in [int, Axis]: raise TypeError('transpose expects a permutation; to swap two axes use swapaxes') perm = [Axis(p) for p in sanitize_permutation(perm)] return transpose(x, perm, name) @typemap def swapaxes(x, axis1=0, axis2=1, name=''):
80
80
269
22
58
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
swapaxes
swapaxes
2,588
2,611
2,588
2,589
39f86ea7e8860fc6310d0f5be652027413c0aed0
bigcode/the-stack
train
1383d6aaedd6e982af9c97b0
train
function
@typemap def mean(*operands, **kw_name): ''' Create a new Function instance that computes element-wise mean of input tensors. Example: >>> in1 = C.input_variable((4,)) >>> in2 = C.input_variable((4,)) >>> model = C.mean([in1, in2]) >>> in1_data = np.asarray([[1., 2., 3., 4....
@typemap def mean(*operands, **kw_name):
''' Create a new Function instance that computes element-wise mean of input tensors. Example: >>> in1 = C.input_variable((4,)) >>> in2 = C.input_variable((4,)) >>> model = C.mean([in1, in2]) >>> in1_data = np.asarray([[1., 2., 3., 4.]], np.float32) >>> in2_data = np...
operands[0], (tuple, list)): operands = operands[0] if isinstance(operands, tuple): operands = list(operands) operands_unfold = [] for o in operands: if hasattr(o, 'outputs') and len(o.outputs) > 1: operands_unfold += o.outputs else: operands_unfold +=...
107
107
359
14
93
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
mean
mean
84
117
84
85
af1ca2f27ceed8aca51d10b51dbc80c8ac1fc2dd
bigcode/the-stack
train
af02f8aeadd4dc04eed15cd4
train
function
@typemap def ceil(arg, name=''): ''' The output of this operation is the element wise value rounded to the smallest integer greater than or equal to the input. Example: >>> C.ceil([0.2, 1.3, 4., 5.5, 0.0]).eval() array([ 1., 2., 4., 6., 0.], dtype=float32) >>> C.ceil([[0.6,...
@typemap def ceil(arg, name=''):
''' The output of this operation is the element wise value rounded to the smallest integer greater than or equal to the input. Example: >>> C.ceil([0.2, 1.3, 4., 5.5, 0.0]).eval() array([ 1., 2., 4., 6., 0.], dtype=float32) >>> C.ceil([[0.6, 3.3], [1.9, 5.6]]).eval() ...
of the Function instance in the network (optional) Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import floor arg = sanitize_input(arg, get_data_type(arg)) return floor(arg, name) @typemap def ceil(arg, name=''):
67
67
224
11
56
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
ceil
ceil
1,311
1,333
1,311
1,312
b70f0f2d0528a74ad944591970034642c034e2cc
bigcode/the-stack
train
dedafd61ded8f8ac00b93bc0
train
function
@typemap def greater_equal(left, right, name=''): ''' Elementwise 'greater equal' comparison of two tensors. Result is 1 if left >= right else 0. Example: >>> C.greater_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 1., 1.], dtype=float32) >>> C.greater_equal([-1,0,1]...
@typemap def greater_equal(left, right, name=''):
''' Elementwise 'greater equal' comparison of two tensors. Result is 1 if left >= right else 0. Example: >>> C.greater_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 1., 1.], dtype=float32) >>> C.greater_equal([-1,0,1], [0]).eval() array([ 0., 1., 1.], dtype...
.ops.functions.Function` ''' from cntk.cntk_py import greater dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return greater(left, right, name) @typemap def greater_equal(left, right, name=''):
68
68
227
14
54
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
greater_equal
greater_equal
767
790
767
768
bc64b401d0d96699c6a3427f7737d136912e813b
bigcode/the-stack
train
260a11e754ab0d1f42d87228
train
function
@typemap def exp(x, name=''): ''' Computes the element-wise exponential of ``x``: :math:`\exp(x) = {e^x}` Example: >>> C.exp([0., 1.]).eval() array([ 1. , 2.718282], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tenso...
@typemap def exp(x, name=''):
''' Computes the element-wise exponential of ``x``: :math:`\exp(x) = {e^x}` Example: >>> C.exp([0., 1.]).eval() array([ 1. , 2.718282], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional)...
in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import hard_sigmoid x = sanitize_input(x) return hard_sigmoid(x, alpha, beta, name) @typemap def exp(x, name=''):
64
64
157
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
exp
exp
2,029
2,048
2,029
2,030
5392b979e19508186c87a27d75f7a076c8639883
bigcode/the-stack
train
2a6e01a3a5e12cdd8ace8220
train
function
@typemap def softplus(x, steepness=1, name=''): ''' Softplus operation. Computes the element-wise softplus of ``x``: :math:`\mathrm{softplus}(x) = {\log(1+\exp(x))}` The optional ``steepness`` allows to make the knee sharper (``steepness>1``) or softer, by computing ``softplus(x * steepness) / ste...
@typemap def softplus(x, steepness=1, name=''):
''' Softplus operation. Computes the element-wise softplus of ``x``: :math:`\mathrm{softplus}(x) = {\log(1+\exp(x))}` The optional ``steepness`` allows to make the knee sharper (``steepness>1``) or softer, by computing ``softplus(x * steepness) / steepness``. (For very large steepness, this ap...
.straight_through_impl(x).eval({x:data}) array([[-1., 1., -1.]], dtype=float32) Args: inputs: one input tensor name (str, optional, keyword only): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py impo...
132
132
440
17
114
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
softplus
softplus
1,555
1,589
1,555
1,556
15e4357abc1a35f96c9e391e845c66b8803b1ec9
bigcode/the-stack
train
34c17206dcae157f08ae61d1
train
function
@typemap def log_softmax(x, axis = None, name = ''): ''' Computes the logsoftmax normalized values of x. That is, y = x - log(reduce_sum(exp(x), axis)) (the implementation uses an equivalent formula for numerical stability). It is also possible to use `x - reduce_log_sum_exp(x, axis)` instead of log_so...
@typemap def log_softmax(x, axis = None, name = ''):
''' Computes the logsoftmax normalized values of x. That is, y = x - log(reduce_sum(exp(x), axis)) (the implementation uses an equivalent formula for numerical stability). It is also possible to use `x - reduce_log_sum_exp(x, axis)` instead of log_softmax: this can be faster (one reduce pass instea...
): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import asinh x = sanitize_input(x) return asinh(x, name) @typemap def log_softmax(x, axis = None, name = ''):
72
72
243
18
54
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
log_softmax
log_softmax
1,878
1,900
1,878
1,879
d7e5c23a2970cd0b66e544041e67f812569867a8
bigcode/the-stack
train
331553c0d2ab8d9213b71732
train
function
@typemap def reduce_mean(x, axis=None, keepdims=True, name=''): ''' Computes the mean of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]...
@typemap def reduce_mean(x, axis=None, keepdims=True, name=''):
''' Computes the mean of the input tensor's elements across a specified axis or a list of specified axes. Example: >>> # create 3x2x2 matrix in a sequence of length 1 in a batch of one sample >>> data = np.array([[[5,1], [20,2]],[[30,1], [40,2]],[[55,1], [60,2]]], dtype=np.float32) ...
tuple` of int or :class:`~cntk.axis.Axis`): axis along which the reduction will be performed keepdims (boolean): Keep the reduced dimension or not, default True mean keep reduced dimension name (str): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Func...
180
180
601
19
161
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_mean
reduce_mean
3,052
3,100
3,052
3,053
02c2352c9309df5b885d8b4bbe1f1ae19e0ef8f0
bigcode/the-stack
train
eb6e33e03b23662f91d97bf7
train
function
@typemap def equal(left, right, name=''): ''' Elementwise 'equal' comparison of two tensors. Result is 1 if values are equal 0 otherwise. Example: >>> C.equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 1., 0.], dtype=float32) >>> C.equal([-1,0,1], [1]).eval() ar...
@typemap def equal(left, right, name=''):
''' Elementwise 'equal' comparison of two tensors. Result is 1 if values are equal 0 otherwise. Example: >>> C.equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 1., 0.], dtype=float32) >>> C.equal([-1,0,1], [1]).eval() array([ 0., 0., 1.], dtype=float32) A...
.Function` ''' from cntk.cntk_py import less dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return less(left, right, name) @typemap def equal(left, right, name=''):
65
65
219
13
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
equal
equal
715
738
715
716
bad4e0da0c39f171bf6aebae293e0ef34c63a61e
bigcode/the-stack
train
d0f55a4de5a769397b791765
train
function
@typemap def placeholder(shape=None, dynamic_axes=None, name=''): ''' It creates a placeholder variable that has to be later bound to an actual variable. A common use of this is to serve as a placeholder for a later output variable in a recurrent network, which is replaced with the actual output variabl...
@typemap def placeholder(shape=None, dynamic_axes=None, name=''):
''' It creates a placeholder variable that has to be later bound to an actual variable. A common use of this is to serve as a placeholder for a later output variable in a recurrent network, which is replaced with the actual output variable by calling replace_placeholder(s). Args: shape ...
_axes: if not a.is_dynamic_axis: raise ValueError('axis in dynamic_axes attribute is not dynamic') dynamic_axes = list(reversed(dynamic_axes)) return output_variable(shape, dtype, dynamic_axes, needs_gradient, name) @typemap def placeholder(shape=None, dynamic_axes=None, name=''):
66
66
222
16
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
placeholder
placeholder
3,711
3,738
3,711
3,712
75cc53fcce6257af756c38d5f1584a8dd4d0e7a5
bigcode/the-stack
train
e6c80ebc495d58220c5c3ecc
train
function
@typemap def reconcile_dynamic_axes(x, dynamic_axes_as, name=''): ''' Create a new Function instance which reconciles the dynamic axes of the specified tensor operands. The output of the returned Function has the sample layout of the 'x' operand and the dynamic axes of the 'dynamic_axes_as' operand. ...
@typemap def reconcile_dynamic_axes(x, dynamic_axes_as, name=''):
''' Create a new Function instance which reconciles the dynamic axes of the specified tensor operands. The output of the returned Function has the sample layout of the 'x' operand and the dynamic axes of the 'dynamic_axes_as' operand. This operator also performs a runtime check to ensure that th...
of the Alias Function in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import alias x = sanitize_input(x) return alias(x, name) @typemap def reconcile_dynamic_axes(x, dynamic_axes_as, name=''):
66
66
223
17
49
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reconcile_dynamic_axes
reconcile_dynamic_axes
219
240
219
220
fc78346e9fe04a950370f107707cfe1fea77f005
bigcode/the-stack
train
a1eeebe30c5ae3a7638e35df
train
function
@typemap def output_variable(shape, dtype, dynamic_axes, needs_gradient=True, name=''): ''' It creates an output variable that is used to define a user defined function. Args: shape (tuple or int): the shape of the input tensor dtype (np.float32 or np.float64 or np.float16): data type ...
@typemap def output_variable(shape, dtype, dynamic_axes, needs_gradient=True, name=''):
''' It creates an output variable that is used to define a user defined function. Args: shape (tuple or int): the shape of the input tensor dtype (np.float32 or np.float64 or np.float16): data type dynamic_axes (list or tuple): a list of dynamic axis (e.g., batch axis, time axis) ...
(dtype) dynamic_axes = sanitize_dynamic_axes(dynamic_axes) # TODO dynamic axis for numpy arrays # TODO sparse for numpy arrays return input_variable(shape, is_sparse, dtype, needs_gradient, name, dynamic_axes) @typemap def output_variable(shape, dtype, dynamic_axes, needs_gradient=True, name=''):
69
69
232
21
48
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
output_variable
output_variable
3,683
3,709
3,683
3,684
6b7b78ad872a4bc0ee3184ecaade2ed7f4c194c9
bigcode/the-stack
train
8bfa716be254a4f6665ec42f
train
function
@typemap def argmin(x, axis=None, name=''): ''' Computes the argmin of the input tensor's elements across the specified axis. If no axis is specified, it will return the flatten index of the smallest element in tensor x. Example: >>> # create 3x2 matrix in a sequence of length 1 in a batch ...
@typemap def argmin(x, axis=None, name=''):
''' Computes the argmin of the input tensor's elements across the specified axis. If no axis is specified, it will return the flatten index of the smallest element in tensor x. Example: >>> # create 3x2 matrix in a sequence of length 1 in a batch of one sample >>> data = [[10, 30],[...
default to ''): the name of the Function instance in the network Returns: cntk.ops.functions.Function: An instance of :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import argmax x = sanitize_input(x) axis = sanitize_axis(axis) return argmax(x, axis, name) @typemap...
91
91
306
15
76
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
argmin
argmin
3,364
3,395
3,364
3,365
238665d4a225489d66a18b226a7bbfe3e449269a
bigcode/the-stack
train
459475d34212a69bef1e98f1
train
function
@typemap def to_batch(x, name=''): ''' Concatenate the input tensor's first axis to batch axis. Example: >>> data = np.arange(12).reshape((3,2,2)) >>> x = C.constant(value=data) >>> y = C.to_batch(x) >>> y.shape (2, 2) Args: x: a tensor with dynamic axis...
@typemap def to_batch(x, name=''):
''' Concatenate the input tensor's first axis to batch axis. Example: >>> data = np.arange(12).reshape((3,2,2)) >>> x = C.constant(value=data) >>> y = C.to_batch(x) >>> y.shape (2, 2) Args: x: a tensor with dynamic axis name: (str, optional, keyw...
name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import unpack_batch x = sanitize_input(x) return unpack_batch(x, name) @typemap def to_batch(x, name=''):
64
64
153
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
to_batch
to_batch
2,823
2,844
2,823
2,824
b461726e340c3b3edab2b431c1ac73dc29f56a19
bigcode/the-stack
train
79ab5655fb389bdfe0099dc0
train
function
@typemap def flatten(x, axis = None, name = ''): ''' Flattens the input tensor into a 2D matrix. If the input tensor has shape (d_0, d_1, ... d_n) then the output will have shape (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis+1) ... X dn). Example: >>> # create 2x3x4 matrix, flatten the matrix at ...
@typemap def flatten(x, axis = None, name = ''):
''' Flattens the input tensor into a 2D matrix. If the input tensor has shape (d_0, d_1, ... d_n) then the output will have shape (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis+1) ... X dn). Example: >>> # create 2x3x4 matrix, flatten the matrix at axis = 1 >>> shape = (2, 3, 4) >...
supported. name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import gather_op indices = sanitize_input(indices) reference = sanitize_input(reference) if axis is None: return gather...
115
115
385
16
99
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
flatten
flatten
2,917
2,947
2,917
2,918
bbb2c807a848ddb6277343fe233669d793d6fb58
bigcode/the-stack
train
52d649a4642a07f59a1d2ed6
train
function
@typemap def leaky_relu(x, alpha = 0.01, name=''): ''' Leaky Rectified linear operation. Computes the element-wise leaky rectified linear of ``x``: ``max(x, 0)`` for ``x >= 0`` and ``x``: ``alpha*x`` otherwise. The output tensor has the same shape as ``x``. Example: >>> C.leaky_relu([[-1, ...
@typemap def leaky_relu(x, alpha = 0.01, name=''):
''' Leaky Rectified linear operation. Computes the element-wise leaky rectified linear of ``x``: ``max(x, 0)`` for ``x >= 0`` and ``x``: ``alpha*x`` otherwise. The output tensor has the same shape as ``x``. Example: >>> C.leaky_relu([[-1, -0.5, 0, 1, 2]]).eval() array([[-0.01 , -0....
the Function instance in the network Returns: cntk.ops.functions.Function: An instance of :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import selu x = sanitize_input(x) return selu(x, scale, alpha, name) @typemap def leaky_relu(x, alpha = 0.01, name=''):
84
84
280
20
64
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
leaky_relu
leaky_relu
1,480
1,503
1,480
1,481
27697f4a38b291edd74eaf1d2ac9334aee4c8460
bigcode/the-stack
train
2e8f5224c10bf27d02159eea
train
function
@typemap def pow(base, exponent, name=''): ''' Computes `base` raised to the power of `exponent`. It supports broadcasting. This is well defined if `base` is non-negative or `exponent` is an integer. Otherwise the result is NaN. The gradient with respect to the base is well defined if the forward o...
@typemap def pow(base, exponent, name=''):
''' Computes `base` raised to the power of `exponent`. It supports broadcasting. This is well defined if `base` is non-negative or `exponent` is an integer. Otherwise the result is NaN. The gradient with respect to the base is well defined if the forward operation is well defined. The gradient with...
name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import minus dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return minus(le...
94
94
316
13
81
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
pow
pow
957
987
957
958
cd4f281b9bee4c22fcb56897bd4082f03adcb982
bigcode/the-stack
train
a0127c7f546a3c08a34da8e3
train
function
@typemap def custom_proxy_op(custom_op, output_shape, output_data_type, *operands, **kw_name): ''' A proxy node that helps saving a model with different number of operands. Example: Args: Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import custom_proxy_op ...
@typemap def custom_proxy_op(custom_op, output_shape, output_data_type, *operands, **kw_name):
''' A proxy node that helps saving a model with different number of operands. Example: Args: Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import custom_proxy_op if len(operands) == 1 and isinstance(operands[0], (tuple, list)): operands = operan...
be non-negative.') operand = sanitize_input(operand, get_data_type(operand)) return mean_variance_normalization(operand, epsilon, use_stats_across_channels, do_variance_scaling, name) @typemap def custom_proxy_op(custom_op, output_shape, output_data_type, *operands, **kw_name):
71
71
237
26
45
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
custom_proxy_op
custom_proxy_op
4,138
4,164
4,138
4,139
fc7e9b9fa23971bba01cfd59ab0f9b0766840f13
bigcode/the-stack
train
9fca570c4db7706c9f373a32
train
function
@typemap def zeros_like(x, name=''): ''' Creates an all-zeros tensor with the same shape and dynamic axes as ``x``: Example: >>> x0 = np.arange(24).reshape((2, 3, 4)).astype('f') >>> x = C.input_variable((3, 4)) >>> C.zeros_like(x).eval({x: x0}) array([[[ 0., 0., 0., 0.],...
@typemap def zeros_like(x, name=''):
''' Creates an all-zeros tensor with the same shape and dynamic axes as ``x``: Example: >>> x0 = np.arange(24).reshape((2, 3, 4)).astype('f') >>> x = C.input_variable((3, 4)) >>> C.zeros_like(x).eval({x: x0}) array([[[ 0., 0., 0., 0.], [ 0., 0., 0., 0.]...
:class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import ones_like x = sanitize_input(x) return ones_like(x, name) @typemap def zeros...
87
87
293
12
75
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
zeros_like
zeros_like
2,293
2,318
2,293
2,294
831445785472b68d4e9d629af49e21ff3b207471
bigcode/the-stack
train
36160c5e117a393829cc7651
train
function
@typemap def relu(x, name=''): ''' Rectified linear operation. Computes the element-wise rectified linear of ``x``: ``max(x, 0)`` The output tensor has the same shape as ``x``. Example: >>> C.relu([[-1, -0.5, 0, 1, 2]]).eval() array([[ 0., 0., 0., 1., 2.]], dtype=float32) ...
@typemap def relu(x, name=''):
''' Rectified linear operation. Computes the element-wise rectified linear of ``x``: ``max(x, 0)`` The output tensor has the same shape as ``x``. Example: >>> C.relu([[-1, -0.5, 0, 1, 2]]).eval() array([[ 0., 0., 0., 1., 2.]], dtype=float32) Args: x: numpy array or...
sanitize_input(x, get_data_type(x)) min_value = sanitize_input(min_value, get_data_type(min_value)) max_value = sanitize_input(max_value, get_data_type(max_value)) return clip(x, min_value, max_value, name) @typemap def relu(x, name=''):
64
64
197
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
relu
relu
1,408
1,428
1,408
1,409
f4a065721a369dc9111531e37ec022c727cbd39e
bigcode/the-stack
train
932856b44ac3c3ee949dbb42
train
function
@typemap def hardmax(x, name=''): ''' Creates a tensor with the same shape as the input tensor, with zeros everywhere and a 1.0 where the maximum value of the input tensor is located. If the maximum value is repeated, 1.0 is placed in the first location found. Example: >>> C.hardmax([1., 1., 2....
@typemap def hardmax(x, name=''):
''' Creates a tensor with the same shape as the input tensor, with zeros everywhere and a 1.0 where the maximum value of the input tensor is located. If the maximum value is repeated, 1.0 is placed in the first location found. Example: >>> C.hardmax([1., 1., 2., 3.]).eval() array([ 0., ...
.ops.functions.Function` ''' from cntk.cntk_py import softmax x = sanitize_input(x) if axis is not None: axis = sanitize_axis(axis) return softmax(x, axis, name) else: return softmax(x, name) @typemap def hardmax(x, name=''):
72
72
242
12
60
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
hardmax
hardmax
1,950
1,971
1,950
1,951
82fa0677cabe1ac25f34c547d3677349d5d30447
bigcode/the-stack
train
ed23d6aa476def7ab0013369
train
function
@typemap def element_select(flag, value_if_true, value_if_false, name=''): ''' return either ``value_if_true`` or ``value_if_false`` based on the value of ``flag``. If ``flag`` != 0 ``value_if_true`` is returned, otherwise ``value_if_false``. Behaves analogously to numpy.where(...). Example: ...
@typemap def element_select(flag, value_if_true, value_if_false, name=''):
''' return either ``value_if_true`` or ``value_if_false`` based on the value of ``flag``. If ``flag`` != 0 ``value_if_true`` is returned, otherwise ``value_if_false``. Behaves analogously to numpy.where(...). Example: >>> C.element_select([-10, -1, 0, 0.3, 100], [1, 10, 100, 1000, 10000], [...
"%s" is provided as the operand'%x)) if any([ax.is_sequence_axis for ax in x.dynamic_axes]): raise (ValueError( 'eye_like operand must have no sequence axis however "%s" is provided as the operand' % x)) return eye_like(x, sparse_output, name) @typemap def element_select(flag, value_if_true...
86
86
287
20
66
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_select
element_select
2,351
2,374
2,351
2,352
48f4b48fa6792a4dce37ddd4f035ce4572b85952
bigcode/the-stack
train
80f2598bc959dcaad1ea8b55
train
function
@typemap def softsign(x, steepness=1, name=''): ''' Computes the element-wise softsign of ``x``: :math:`sigmoid(x) = {x \over {1+\abs(x)}}` The output tensor has the same shape as ``x``. Example: >>> C.softsign([[-1, 0, 1]]).eval() array([[-0.5, 0. , 0.5]], dtype=float32) A...
@typemap def softsign(x, steepness=1, name=''):
''' Computes the element-wise softsign of ``x``: :math:`sigmoid(x) = {x \over {1+\abs(x)}}` The output tensor has the same shape as ``x``. Example: >>> C.softsign([[-1, 0, 1]]).eval() array([[-0.5, 0. , 0.5]], dtype=float32) Args: x: numpy array or any :class:`~cntk...
softplus(x, name) xp = placeholder() f = typemap(softplus)(steepness * xp) / steepness return as_block(f, [(xp, x)], 'softplus', name) @typemap def softsign(x, steepness=1, name=''):
64
64
192
17
47
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
softsign
softsign
1,591
1,612
1,591
1,592
45dfb3ca022aa45bc5fc2c39732d87366c4b9e5c
bigcode/the-stack
train
3a307948743134d2674183de
train
function
@typemap def one_hot(x, num_classes, sparse_output=False, axis=-1, name=''): ''' Create one hot tensor based on the input tensor Example: >>> data = np.asarray([[1, 2], ... [4, 5]], dtype=np.float32) >>> x = C.input_variable((2,)) >>> C.one_hot(x, 6, Fals...
@typemap def one_hot(x, num_classes, sparse_output=False, axis=-1, name=''):
''' Create one hot tensor based on the input tensor Example: >>> data = np.asarray([[1, 2], ... [4, 5]], dtype=np.float32) >>> x = C.input_variable((2,)) >>> C.one_hot(x, 6, False).eval({x:data}) array([[[ 0., 1., 0., 0., 0., 0.], ...
.shape (2, 2) Args: x: a tensor with dynamic axis name: (str, optional, keyword only): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import to_batch x = sanitize_input(x) return to_batch(x, ...
108
108
361
23
85
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
one_hot
one_hot
2,846
2,876
2,846
2,847
a2077a767c43a5c54dd086f782d149365d9db281
bigcode/the-stack
train
03847ced143a851d985fa5f4
train
function
@typemap def element_or(x, y, name=''): ''' Computes the element-wise logic OR of ``x`` and ``y``. Example: >>> C.element_or([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 1., 1., 1., 0.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that o...
@typemap def element_or(x, y, name=''):
''' Computes the element-wise logic OR of ``x`` and ``y``. Example: >>> C.element_or([1, 1, 0, 0], [1, 0, 1, 0]).eval() array([ 1., 1., 1., 0.], dtype=float32) Args: x, y: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optio...
the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import element_not x = sanitize_input(x) return element_not(x, name) @typemap def element_or(x, y, name=''):
64
64
184
14
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_or
element_or
2,183
2,201
2,183
2,184
f3af0c159bd4d3788642090e445bead411f56f24
bigcode/the-stack
train
9c2d9d79cc4f9b8b34220432
train
function
@typemap def square(x, name=''): ''' Computes the element-wise square of ``x``: Example: >>> C.square([1., 10.]).eval() array([ 1., 100.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the...
@typemap def square(x, name=''):
''' Computes the element-wise square of ``x``: Example: >>> C.square([1., 10.]).eval() array([ 1., 100.], dtype=float32) Args: x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in...
Note: CNTK returns zero for sqrt of negative nubmers, this will be changed to return NaN ''' from cntk.cntk_py import sqrt x = sanitize_input(x) return sqrt(x, name) @typemap def square(x, name=''):
64
64
139
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
square
square
2,103
2,120
2,103
2,104
08d4c0a45f9a9e7500a7fa600905790a3a5f7bbd
bigcode/the-stack
train
6c877be07ce263092e120b75
train
function
@typemap def transpose(x, perm, name=''): ''' Permutes the axes of the tensor. The output has the same data but the axes are permuted according to ``perm``. Example: >>> a = np.arange(24).reshape(2,3,4).astype('f') >>> np.array_equal(C.transpose(a, perm=(2, 0, 1)).eval(), np.transpose(a...
@typemap def transpose(x, perm, name=''):
''' Permutes the axes of the tensor. The output has the same data but the axes are permuted according to ``perm``. Example: >>> a = np.arange(24).reshape(2,3,4).astype('f') >>> np.array_equal(C.transpose(a, perm=(2, 0, 1)).eval(), np.transpose(a, (2, 0, 1))) True Args: ...
instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import expand_dims x = sanitize_input(x) axis = sanitize_axis(axis) return expand_dims(x, axis, name) @typemap def transpose(x, perm, name=''):
70
70
236
13
57
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
transpose
transpose
2,562
2,585
2,562
2,563
ce17ef20e85c82d1f99075bc5cc87c0cfbe8e872
bigcode/the-stack
train
6126ca984b913de391f800cf
train
function
@typemap def random_sample( weights, num_samples, allow_duplicates, seed = SentinelValueForAutoSelectRandomSeed, name=''): ''' Estimates inclusion frequencies for random sampling with or without replacement. The output value is a set of num_samples random samples represented by ...
@typemap def random_sample( weights, num_samples, allow_duplicates, seed = SentinelValueForAutoSelectRandomSeed, name=''):
''' Estimates inclusion frequencies for random sampling with or without replacement. The output value is a set of num_samples random samples represented by a (sparse) matrix of shape [num_samples x len(weights)], where len(weights) is the number of classes (categories) to choose from. The o...
from cntk.cntk_py import to_sequence_like x = sanitize_input(x) dynamic_axes_like = sanitize_input(dynamic_axes_like) return to_sequence_like(x, dynamic_axes_like, name) ####################################################################### # training ops ################################################...
87
87
292
34
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
random_sample
random_sample
3,463
3,500
3,463
3,469
292fca0f35568bcc9608397fb9ab9052674c51af
bigcode/the-stack
train
5a54d09d9b484ec85cbe2b5e
train
function
@associative_multi_arg @typemap def element_min(left, right, name=''): ''' The output of this operation is the element-wise min of the two or more input tensors. It supports broadcasting. Args: arg1: left side tensor arg2: right side tensor *more_args: additional inputs ...
@associative_multi_arg @typemap def element_min(left, right, name=''):
''' The output of this operation is the element-wise min of the two or more input tensors. It supports broadcasting. Args: arg1: left side tensor arg2: right side tensor *more_args: additional inputs name (str, optional): the name of the Function instance in the network ...
_max dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return cntk_py_element_max(left, right, name) @associative_multi_arg @typemap def element_min(left, right, name=''):
64
64
167
21
43
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_min
element_min
1,041
1,060
1,041
1,043
125e8a96d19f108caf7e899fc98884fa1b06df2f
bigcode/the-stack
train
52be0148828e94a707272936
train
function
@typemap def sigmoid(x, name=''): ''' Computes the element-wise sigmoid of ``x``: :math:`sigmoid(x) = {1 \over {1+\exp(-x)}}` The output tensor has the same shape as ``x``. Example: >>> C.sigmoid([-2, -1., 0., 1., 2.]).eval() array([ 0.119203, 0.268941, 0.5 , 0.731059, 0.8...
@typemap def sigmoid(x, name=''):
''' Computes the element-wise sigmoid of ``x``: :math:`sigmoid(x) = {1 \over {1+\exp(-x)}}` The output tensor has the same shape as ``x``. Example: >>> C.sigmoid([-2, -1., 0., 1., 2.]).eval() array([ 0.119203, 0.268941, 0.5 , 0.731059, 0.880797], dtype=float32) Args: ...
the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import softsign x = sanitize_input(x) return softsign(x, name) @typemap def sigmoid(x, name=''):
64
64
207
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
sigmoid
sigmoid
1,614
1,635
1,614
1,615
b936cf0ab73b9a1aeb07281233c91440edb5db25
bigcode/the-stack
train
a159f719182310bd172c9923
train
function
@typemap def dropout(x, dropout_rate=0.0, seed = SentinelValueForAutoSelectRandomSeed, name=''): ''' Each element of the input is independently set to 0 with probability ``dropout_rate`` or to 1 / (1 - ``dropout_rate``) times its original value (with probability 1-``dropout_rate``). Dropout is a good wa...
@typemap def dropout(x, dropout_rate=0.0, seed = SentinelValueForAutoSelectRandomSeed, name=''):
''' Each element of the input is independently set to 0 with probability ``dropout_rate`` or to 1 / (1 - ``dropout_rate``) times its original value (with probability 1-``dropout_rate``). Dropout is a good way to reduce overfitting. This behavior only happens during training. During inference dropou...
are >>> # forced to pick the low weight classes too >>> f = random_sample_inclusion_frequency(w, 150, False).eval() >>> f[0] 1.0 Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import random_sample_inclusion_frequency weights = sanitize_inpu...
135
135
451
28
107
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
dropout
dropout
3,565
3,604
3,565
3,566
91dbbcee8bfb885b842f3028976115f280062374
bigcode/the-stack
train
ce731c464eb1d7ae14c1f941
train
function
@typemap def alias(x, name=''): ''' Create a new Function instance which just aliases the specified 'x' Function/Variable such that the 'Output' of the new 'Function' is same as the 'Output' of the specified 'x' Function/Variable, and has the newly specified name. The purpose of this operator is...
@typemap def alias(x, name=''):
''' Create a new Function instance which just aliases the specified 'x' Function/Variable such that the 'Output' of the new 'Function' is same as the 'Output' of the specified 'x' Function/Variable, and has the newly specified name. The purpose of this operator is to create a new distinct refere...
str, optional): the name of the Alias Function in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import as_composite return as_composite(root_function, name) @typemap def alias(x, name=''):
64
64
214
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
alias
alias
197
217
197
198
0c213c95e11ddfa4af61407e294e59d645e80be9
bigcode/the-stack
train
212d399c71d3e5d19bb62548
train
function
@typemap def reshape(x, shape, begin_axis=None, end_axis=None, name=''): ''' Reinterpret input samples as having different tensor dimensions One dimension may be specified as 0 and will be inferred The output tensor has the shape specified by 'shape'. Example: >>> i1 = C.input_variable(sha...
@typemap def reshape(x, shape, begin_axis=None, end_axis=None, name=''):
''' Reinterpret input samples as having different tensor dimensions One dimension may be specified as 0 and will be inferred The output tensor has the shape specified by 'shape'. Example: >>> i1 = C.input_variable(shape=(3,2)) >>> C.reshape(i1, (2,3)).eval({i1:np.asarray([[[[0., 1....
0., 0., 0.]], dtype=float32) Returns: :class:`~cntk.ops.functions.Function` ''' # FIXME figure out how to only SKIP the doctest in CPU from cntk.cntk_py import optimized_rnnstack operand = sanitize_input(operand) if recurrent_op not in set(['lstm','gru','rnnReLU','rnnTanh']): ...
176
177
590
21
155
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reshape
reshape
2,437
2,496
2,437
2,438
71d3d34f9d67afb4ae22281e0e596e73b4d1a3f1
bigcode/the-stack
train
cb536ea7b451ad35a76110e8
train
function
@typemap def random_sample_inclusion_frequency( weights, num_samples, allow_duplicates, seed = SentinelValueForAutoSelectRandomSeed, name=''): ''' For weighted sampling with the specified sample size (`num_samples`) this operation computes the expected number of occurrences of each class...
@typemap def random_sample_inclusion_frequency( weights, num_samples, allow_duplicates, seed = SentinelValueForAutoSelectRandomSeed, name=''):
''' For weighted sampling with the specified sample size (`num_samples`) this operation computes the expected number of occurrences of each class in the sampled set. In case of sampling without replacement the result is only an estimate which might be quite rough in the case of small sample size...
int): number of expected samples allow_duplicates (bool): If sampling is done with replacement (`True`) or without (`False`). seed (int): random seed. name (:class:`str`, optional): the name of the Function instance in the network. Returns: :class:`~cntk.ops.functions.Fu...
145
145
486
37
108
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
random_sample_inclusion_frequency
random_sample_inclusion_frequency
3,503
3,562
3,503
3,509
f3357c73d270353c5bb975ce7e859bfbe2e360db
bigcode/the-stack
train
fa09a7cd3a170224ecc80cf8
train
function
@typemap def sin(x, name=''): ''' Computes the element-wise sine of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.sin(np.arcsin([[1,0.5],[-0.25,-0.75]])).eval(),5) array([[ 1. , 0.5 ], [-0.25, -0.75]], dtype=float32) Args: x...
@typemap def sin(x, name=''):
''' Computes the element-wise sine of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.sin(np.arcsin([[1,0.5],[-0.25,-0.75]])).eval(),5) array([[ 1. , 0.5 ], [-0.25, -0.75]], dtype=float32) Args: x: numpy array or any :class:`~...
the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import atanh x = sanitize_input(x) return atanh(x, name) @typemap def sin(x, name=''):
64
64
182
11
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
sin
sin
1,682
1,702
1,682
1,683
4e4132c57b89c851b95ad709fa4f89c2cc6a2cc2
bigcode/the-stack
train
78d621e67ec05c372adaa898
train
function
@typemap def pooling(operand, pooling_type, pooling_window_shape, strides=(1,), auto_padding=[False], ceil_out_dim=False, include_pad=False, name=''): ''' The pooling operations compute a new tensor by selecting the maximum or average value in the pooling input. In the case of average pooling wi...
@typemap def pooling(operand, pooling_type, pooling_window_shape, strides=(1,), auto_padding=[False], ceil_out_dim=False, include_pad=False, name=''):
''' The pooling operations compute a new tensor by selecting the maximum or average value in the pooling input. In the case of average pooling with padding, the average is only over the valid region. N-dimensional pooling allows to create max or average pooling of any dimensions, stride or padding. ...
class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import roipooling if pooling_type != MAX_POOLING: raise ValueError('Unsupported pooling type, ROIPooling support only MAX pooling.') operand = sanitize_input(operand) rois = sanitize_input(rois) roi_output_shape = sanitize_shape...
140
140
468
38
102
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
pooling
pooling
531
566
531
533
e6bb079482d57ee41d5215620f35be00ba12e8d5
bigcode/the-stack
train
ad1d671b01613fe7ed101d40
train
function
@typemap def convolution_transpose(convolution_map, operand, strides=(1,), sharing=[True], auto_padding=[True], output_shape=None, dilation=(1,), reduction_rank=1, max_temp_mem_size_in_samples=0, name=''): ''' Computes the transposed convolution of ``convolution_map`` (typically a tens...
@typemap def convolution_transpose(convolution_map, operand, strides=(1,), sharing=[True], auto_padding=[True], output_shape=None, dilation=(1,), reduction_rank=1, max_temp_mem_size_in_samples=0, name=''):
''' Computes the transposed convolution of ``convolution_map`` (typically a tensor of learnable parameters) with ``operand`` (commonly an image or output of a previous convolution/pooling operation). This is also known as ``fractionally strided convolutional layers``, or, ``deconvolution``. This ope...
axis. max_temp_mem_size_in_samples (int): maximum amount of auxiliary memory (in samples) that should be reserved to perform convolution operations. Some convolution engines (e.g. cuDNN and GEMM-based engines) can benefit from using workspace as it may improve performance. However, sometimes...
256
256
1,296
53
203
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
convolution_transpose
convolution_transpose
423
488
423
425
c34a353958e121c9c73cf27c5c14dcf1c05b28df
bigcode/the-stack
train
70f6026fe391bcd2e245829a
train
function
@typemap def mean_variance_normalization(operand, epsilon=0.00001, use_stats_across_channels=False, do_variance_scaling=True, name=''): ''' Computes mean-variance normalization of the specified input operand. This operation computes and mean and variance for the entire tensor if use_stats_across_channels ...
@typemap def mean_variance_normalization(operand, epsilon=0.00001, use_stats_across_channels=False, do_variance_scaling=True, name=''):
''' Computes mean-variance normalization of the specified input operand. This operation computes and mean and variance for the entire tensor if use_stats_across_channels is True. If use_stats_across_channels is False the computes mean and variance per channel and normalizes each channel with its...
dynamic axes. This function currently only support forward. Args: node_input: class:`~cntk.input_variable` that needs the dtype conversion dtype: data_type (np.float32, np.float64, np.float16): data type of the converted output name (str, optional): the name of the Function instance in...
177
177
593
37
140
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
mean_variance_normalization
mean_variance_normalization
4,092
4,136
4,092
4,093
5521fbe76e2ef44091e2e09793a1512cbd3fd78b
bigcode/the-stack
train
d3e1fc1d71164e2ae8df9eb5
train
function
@associative_multi_arg @typemap def plus(left, right, name=''): ''' The output of this operation is the sum of the two or more input tensors. It supports broadcasting. Example: >>> C.plus([1, 2, 3], [4, 5, 6]).eval() array([ 5., 7., 9.], dtype=float32) >>> C.plus([-5, -4, -3, -2,...
@associative_multi_arg @typemap def plus(left, right, name=''):
''' The output of this operation is the sum of the two or more input tensors. It supports broadcasting. Example: >>> C.plus([1, 2, 3], [4, 5, 6]).eval() array([ 5., 7., 9.], dtype=float32) >>> C.plus([-5, -4, -3, -2, -1], [10]).eval() array([ 5., 6., 7., 8., 9.], dtyp...
if n > 2: return f(tree_reduce(args[:n//2], name=''),tree_reduce(args[n//2:], name=''), name=name) # only the outer-most op gets the 'name' parameter elif n == 2: return f(args[0],args[1], name=name) else: return args[0] return tree_reduce((arg1, arg2) + more_args, name=name) ...
120
120
400
20
99
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
plus
plus
896
927
896
898
7af307dfa14888b995119a8ca8933cd0e157f68d
bigcode/the-stack
train
ba9c983b949c94d12a5a7a4e
train
function
@typemap def minus(left, right, name=''): ''' The output of this operation is left minus right tensor. It supports broadcasting. Example: >>> C.minus([1, 2, 3], [4, 5, 6]).eval() array([-3., -3., -3.], dtype=float32) >>> C.minus([[1,2],[3,4]], 1).eval() array([[ 0., 1.], ...
@typemap def minus(left, right, name=''):
''' The output of this operation is left minus right tensor. It supports broadcasting. Example: >>> C.minus([1, 2, 3], [4, 5, 6]).eval() array([-3., -3., -3.], dtype=float32) >>> C.minus([[1,2],[3,4]], 1).eval() array([[ 0., 1.], [ 2., 3.]], dtype=float32) ...
ntk_py import plus as cntk_py_plus dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return cntk_py_plus(left, right, name) @typemap def minus(left, right, name=''):
64
64
215
13
51
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
minus
minus
930
955
930
931
935deb7f61c6de6a1e3a2cd1b20f88752c447c98
bigcode/the-stack
train
1a7ede2ad6b73f7c69dcb91b
train
function
@typemap def as_composite(root_function, name=''): ''' Creates a composite Function that has the specified root_function as its root. The composite denotes a higher-level Function encapsulating the entire graph of Functions underlying the specified rootFunction. Args: root_function: Root...
@typemap def as_composite(root_function, name=''):
''' Creates a composite Function that has the specified root_function as its root. The composite denotes a higher-level Function encapsulating the entire graph of Functions underlying the specified rootFunction. Args: root_function: Root Function, the graph underlying which, the newly cr...
the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import as_block return as_block(composite, block_arguments_map, block_op_name, block_instance_name) @typemap def as_composite(root_function, name=''):
64
64
132
14
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
as_composite
as_composite
180
195
180
181
5c1e9197115d714c089addae64678438175bf48f
bigcode/the-stack
train
e2ae42e4e0d24bb7bf45a3bf
train
function
@typemap def hard_sigmoid(x, alpha, beta, name = ''): ''' Computes the element-wise HardSigmoid function, y = max(0, min(1, alpha * x + beta)). Example: >>> alpha = 1 >>> beta = 2 >>> C.hard_sigmoid([-2.5, -1.5, 1], alpha, beta).eval() array([ 0. , 0.5, 1. ], dtype=float3...
@typemap def hard_sigmoid(x, alpha, beta, name = ''):
''' Computes the element-wise HardSigmoid function, y = max(0, min(1, alpha * x + beta)). Example: >>> alpha = 1 >>> beta = 2 >>> C.hard_sigmoid([-2.5, -1.5, 1], alpha, beta).eval() array([ 0. , 0.5, 1. ], dtype=float32) Args: x: numpy array or any :class:`~c...
:class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import top_k x = sanitize_input(x) axis = sanitize_axis(axis) return top_k(x, k, axis, name) @typemap def hard_sigmoid(x, alpha, beta, name = ''):
68
68
227
18
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
hard_sigmoid
hard_sigmoid
2,006
2,027
2,006
2,007
606649d22f87cd383c1611e51eb3c1dcaf2bd8b4
bigcode/the-stack
train
2c8f5299c389fd1a8308184d
train
function
@typemap def greater(left, right, name=''): ''' Elementwise 'greater' comparison of two tensors. Result is 1 if left > right else 0. Example: >>> C.greater([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 0., 1.], dtype=float32) >>> C.greater([-1,0,1], [0]).eval() arr...
@typemap def greater(left, right, name=''):
''' Elementwise 'greater' comparison of two tensors. Result is 1 if left > right else 0. Example: >>> C.greater([41., 42., 43.], [42., 42., 42.]).eval() array([ 0., 0., 1.], dtype=float32) >>> C.greater([-1,0,1], [0]).eval() array([ 0., 0., 1.], dtype=float32) Args...
.functions.Function` ''' from cntk.cntk_py import equal dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return equal(left, right, name) @typemap def greater(left, right, name=''):
66
66
221
13
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
greater
greater
741
764
741
742
51be6e3de10d2d69b65175a385ca23619971e603
bigcode/the-stack
train
69f7a5ec83e847b173552f9d
train
function
@typemap def assign(ref, input, name=''): ''' Assign the value in input to ref and return the new value, ref need to be the same layout as input. Both ref and input can't have dynamic axis and broadcast isn't supported for the assign operator. During forward pass, ref will get the new value after the fo...
@typemap def assign(ref, input, name=''):
''' Assign the value in input to ref and return the new value, ref need to be the same layout as input. Both ref and input can't have dynamic axis and broadcast isn't supported for the assign operator. During forward pass, ref will get the new value after the forward or backward pass finish, so that ...
inv_stddev (NumPy array): per dimension standard deviation to use for the normalization name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import per_dim_mean_variance_normalize mean = sanit...
256
256
875
13
243
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
assign
assign
3,843
3,909
3,843
3,844
dd25d27738ce0c5aed9eafc8c98b364a939eaed8
bigcode/the-stack
train
6df00a8913c95af379812b42
train
function
@typemap def cosh(x, name=''): ''' Computes the element-wise cosh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.cosh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.54308, 1.12763], [ 1.03141, 1.29468]], dtype=float32) Args: ...
@typemap def cosh(x, name=''):
''' Computes the element-wise cosh of ``x``: The output tensor has the same shape as ``x``. Example: >>> np.round(C.cosh([[1,0.5],[-0.25,-0.75]]).eval(),5) array([[ 1.54308, 1.12763], [ 1.03141, 1.29468]], dtype=float32) Args: x: numpy array or any :class:...
): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import sinh x = sanitize_input(x) return sinh(x, name) @typemap def cosh(x, name=''):
64
64
189
12
52
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
cosh
cosh
1,834
1,854
1,834
1,835
6fd574da3a6a70ac2273aef01914c455d366fe3d
bigcode/the-stack
train
d29fc1ef3aecc8556b963c5a
train
function
@typemap def times(left, right, output_rank=1, infer_input_rank_to_map=TIMES_NO_INFERRED_INPUT_RANK, name=''): ''' The output of this operation is the matrix product of the two input matrices. It supports broadcasting. Sparse is supported in the left operand, if it is a matrix. The operator '@' has been...
@typemap def times(left, right, output_rank=1, infer_input_rank_to_map=TIMES_NO_INFERRED_INPUT_RANK, name=''):
''' The output of this operation is the matrix product of the two input matrices. It supports broadcasting. Sparse is supported in the left operand, if it is a matrix. The operator '@' has been overloaded such that in Python 3.5 and later X @ W equals times(X, W). For better performance on times op...
2., 3., 4.], dtype=float32) Args: arg1: left side tensor arg2: right side tensor *more_args: additional inputs name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import lo...
189
189
631
34
154
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
times
times
1,119
1,174
1,119
1,120
e8abff3ec68d00b19537a91ff5f52a7bb181ca03
bigcode/the-stack
train
959877ffb2a33d3e84f6b02b
train
function
@typemap def top_k(x, k, axis=-1, name=''): ''' Computes the ``k`` largest values of the input tensor and the corresponding indices along the specified axis (default the last axis). The returned :class:`~cntk.ops.functions.Function` has two outputs. The first one contains the top ``k`` values in s...
@typemap def top_k(x, k, axis=-1, name=''):
''' Computes the ``k`` largest values of the input tensor and the corresponding indices along the specified axis (default the last axis). The returned :class:`~cntk.ops.functions.Function` has two outputs. The first one contains the top ``k`` values in sorted order, and the second one contains ...
x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import hardmax x = sanitize_input(x) return hardmax(x, name) @typemap d...
97
97
325
18
79
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
top_k
top_k
1,974
2,004
1,974
1,975
01ca70626a5fdcc4844146d77e68238e244e3fee
bigcode/the-stack
train
10bea4ca2d9bd86751c2fb2e
train
function
@typemap def not_equal(left, right, name=''): ''' Elementwise 'not equal' comparison of two tensors. Result is 1 if left != right else 0. Example: >>> C.not_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 1., 0., 1.], dtype=float32) >>> C.not_equal([-1,0,1], [0]).eval() ...
@typemap def not_equal(left, right, name=''):
''' Elementwise 'not equal' comparison of two tensors. Result is 1 if left != right else 0. Example: >>> C.not_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 1., 0., 1.], dtype=float32) >>> C.not_equal([-1,0,1], [0]).eval() array([ 1., 0., 1.], dtype=float32) ...
` ''' from cntk.cntk_py import greater_equal dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return greater_equal(left, right, name) @typemap def not_equal(left, right, name=''):
67
67
225
14
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
not_equal
not_equal
793
816
793
794
9025df1f2c2accf74f1bb2d3b14e6eab9d332adc
bigcode/the-stack
train
07233229e10734cd89e0b053
train
function
@associative_multi_arg @typemap def log_add_exp(left, right, name=''): ''' Calculates the log of the sum of the exponentials of the two or more input tensors. It supports broadcasting. Example: >>> a = np.arange(3,dtype=np.float32) >>> np.exp(C.log_add_exp(np.log(1+a), np.log(1+a*a)).ev...
@associative_multi_arg @typemap def log_add_exp(left, right, name=''):
''' Calculates the log of the sum of the exponentials of the two or more input tensors. It supports broadcasting. Example: >>> a = np.arange(3,dtype=np.float32) >>> np.exp(C.log_add_exp(np.log(1+a), np.log(1+a*a)).eval()) array([ 2., 4., 8.], dtype=float32) >>> np.exp(...
.ops.functions.Function` ''' from cntk.cntk_py import element_divide dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return element_divide(left, right, name) @associative_multi_arg @typemap def log_add_exp(left, right, name=''):
80
80
269
22
58
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
log_add_exp
log_add_exp
1,089
1,115
1,089
1,091
ec9c665c43c85b68a3732229af31507cd9c0964f
bigcode/the-stack
train
645b5ac321ad38c08b669be6
train
function
@typemap def reduce_l2(x, axis=None, keepdims = True, name=''): ''' Computes the L2 norm of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pruned. ...
@typemap def reduce_l2(x, axis=None, keepdims = True, name=''):
''' Computes the L2 norm of the input tensor's element along the provided axes. The resulted tensor has the same rank as the input if keepdims equal 1. If keepdims equal 0, then the resulted tensor have the reduced dimension pruned. Example: >>> C.reduce_l2([[[1,2], [3,4]]], 2).eval() ...
network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import reduce_l1 x = sanitize_input(x) axis = sanitize_multi_axis_reduction_list(axis) return reduce_l1(x, axis, keepdims, name) @typemap def reduce_l2(x, axis=None, keepdims = True, name=''):
84
84
281
21
63
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
reduce_l2
reduce_l2
3,261
3,285
3,261
3,262
674598ded10bb6ff27563f21b211a1a1c0648420
bigcode/the-stack
train
42045ea30cc84bba57f364af
train
function
@typemap def ones_like(x, name=''): ''' Creates an all-ones tensor with the same shape and dynamic axes as ``x``: Example: >>> x0 = np.arange(24).reshape((2, 3, 4)).astype('f') >>> x = C.input_variable((3, 4)) >>> C.ones_like(x).eval({x: x0}) array([[[ 1., 1., 1., 1.], ...
@typemap def ones_like(x, name=''):
''' Creates an all-ones tensor with the same shape and dynamic axes as ``x``: Example: >>> x0 = np.arange(24).reshape((2, 3, 4)).astype('f') >>> x = C.input_variable((3, 4)) >>> C.ones_like(x).eval({x: x0}) array([[[ 1., 1., 1., 1.], [ 1., 1., 1., 1.], ...
or any :class:`~cntk.ops.functions.Function` that outputs a tensor name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import reciprocal x = sanitize_input(x) return reciprocal(x, name) @typemap ...
87
87
293
12
75
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
ones_like
ones_like
2,265
2,290
2,265
2,266
5453275777ba26fae52273336e61ced8444dfda8
bigcode/the-stack
train
80520efc600701efe84b8d01
train
function
@typemap def convolution(convolution_map, operand, strides=(1,), sharing=[True], auto_padding=[True], sequential=False, dilation=(1,), reduction_rank=1, groups=1, max_temp_mem_size_in_samples=0, name=''): ''' Computes the convolution of ``convolution_map`` (typically a tensor of learnable parame...
@typemap def convolution(convolution_map, operand, strides=(1,), sharing=[True], auto_padding=[True], sequential=False, dilation=(1,), reduction_rank=1, groups=1, max_temp_mem_size_in_samples=0, name=''):
''' Computes the convolution of ``convolution_map`` (typically a tensor of learnable parameters) with ``operand`` (commonly an image or output of a previous convolution/pooling operation). This operation is used in image and language processing applications. It supports arbitrary dimensions, strides...
input.astype(np.float32), 'label': expanded_labels.astype(np.float32)}) Args: graph: labels graph features: network output blankTokenId: id of the CTC blank label delayConstraint: label output delay constraint introduced during training that allows to have shorter delay du...
256
256
1,393
54
202
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
convolution
convolution
356
421
356
358
c943eb7ec8b0d8e52636ec1b2d830dda0e68e4ce
bigcode/the-stack
train
160ce6e5acd18ffc9aea6645
train
function
@typemap def less_equal(left, right, name=''): ''' Elementwise 'less equal' comparison of two tensors. Result is 1 if left <= right else 0. Example: >>> C.less_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 1., 1., 0.], dtype=float32) >>> C.less_equal([-1,0,1], [0]).eval(...
@typemap def less_equal(left, right, name=''):
''' Elementwise 'less equal' comparison of two tensors. Result is 1 if left <= right else 0. Example: >>> C.less_equal([41., 42., 43.], [42., 42., 42.]).eval() array([ 1., 1., 0.], dtype=float32) >>> C.less_equal([-1,0,1], [0]).eval() array([ 1., 1., 0.], dtype=float32)...
` ''' from cntk.cntk_py import not_equal dtype = get_data_type(left, right) left = sanitize_input(left, dtype) right = sanitize_input(right, dtype) return not_equal(left, right, name) @typemap def less_equal(left, right, name=''):
67
67
225
14
53
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
less_equal
less_equal
819
842
819
820
350dc659d9af28d8b09dfaf27747ce41d3b05be1
bigcode/the-stack
train
d2ed0dff39a65dfc3b042c94
train
function
@typemap def selu(x, scale=1.0507009873554804934193349852946, alpha=1.6732632423543772848170429916717, name=''): ''' Scaled exponential linear unit operation. Computes the element-wise exponential linear of ``x``: ``scale * x`` for ``x >= 0`` and ``x``: ``scale * alpha * (exp(x)-1)`` otherwise. The out...
@typemap def selu(x, scale=1.0507009873554804934193349852946, alpha=1.6732632423543772848170429916717, name=''):
''' Scaled exponential linear unit operation. Computes the element-wise exponential linear of ``x``: ``scale * x`` for ``x >= 0`` and ``x``: ``scale * alpha * (exp(x)-1)`` otherwise. The output tensor has the same shape as ``x``. Example: >>> C.selu([[-1, -0.5, 0, 1, 2]]).eval() ar...
An instance of :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import elu x = sanitize_input(x) return elu(x, alpha, name) @typemap def selu(x, scale=1.0507009873554804934193349852946, alpha=1.6732632423543772848170429916717, name=''):
87
87
291
44
43
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
selu
selu
1,455
1,477
1,455
1,456
fa00f0796d0c1214e0e17068622f3192f84655a8
bigcode/the-stack
train
c28f885fc14e4fd681522c98
train
function
@typemap def local_response_normalization(operand, depth_radius, bias, alpha, beta, name=''): ''' Local Response Normalization layer. See Section 3.3 of the paper: https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf The mathematical equation is: `...
@typemap def local_response_normalization(operand, depth_radius, bias, alpha, beta, name=''):
''' Local Response Normalization layer. See Section 3.3 of the paper: https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf The mathematical equation is: ``b_{x,y}^i=a_{x,y}^i/(bias+\alpha\sum_{j=max(0,i-depth_radius)}^{min(N-1, i+depth_radius)}(a_{...
", Warning) from cntk.cntk_py import batch_normalization operand = sanitize_input(operand) return batch_normalization(operand, scale, bias, running_mean, running_inv_std, running_count, spatial, normalization_time_constant, blend_time_constant, ...
96
96
323
24
72
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
local_response_normalization
local_response_normalization
657
683
657
658
82ac6ac00a7b7f1d58b489519a115ddbd4edc05a
bigcode/the-stack
train
7435475074029a501ba315f3
train
function
@typemap def straight_through_impl(x, name=''): ''' element-wise binarization node using the straight through estimator Example: >>> # create (1,3) matrix >>> data = np.asarray([[-3, 4, -2]], dtype=np.float32) >>> x = C.input_variable((3)) >>> C.straight_through_impl(x).eva...
@typemap def straight_through_impl(x, name=''):
''' element-wise binarization node using the straight through estimator Example: >>> # create (1,3) matrix >>> data = np.asarray([[-3, 4, -2]], dtype=np.float32) >>> x = C.input_variable((3)) >>> C.straight_through_impl(x).eval({x:data}) array([[-1., 1., -1.]], dtyp...
.functions.Function: An instance of :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import pre_lu x = sanitize_input(x) return pre_lu(alpha, x, name) @typemap def straight_through_impl(x, name=''):
64
64
192
14
50
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
straight_through_impl
straight_through_impl
1,531
1,553
1,531
1,532
dbec565e6c8afc63222f370f60e956228d76af57
bigcode/the-stack
train
d78091c26772c619cbfa5ea3
train
function
@associative_multi_arg @typemap def element_times(left, right, name=''): ''' The output of this operation is the element-wise product of the two or more input tensors. It supports broadcasting. Example: >>> C.element_times([1., 1., 1., 1.], [0.5, 0.25, 0.125, 0.]).eval() array([ 0.5 , ...
@associative_multi_arg @typemap def element_times(left, right, name=''):
''' The output of this operation is the element-wise product of the two or more input tensors. It supports broadcasting. Example: >>> C.element_times([1., 1., 1., 1.], [0.5, 0.25, 0.125, 0.]).eval() array([ 0.5 , 0.25 , 0.125, 0. ], dtype=float32) >>> C.element_times([5.,...
name (str, optional): the name of the Function instance in the network Returns: :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import pow dtype = get_data_type(base, exponent) base = sanitize_input(base, dtype) exponent = sanitize_input(exponent, dtype) return ...
104
104
348
21
83
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
element_times
element_times
989
1,018
989
991
2dab2956942c7817b3434eee732fb79c92acaf0d
bigcode/the-stack
train
382ad78631db45395744b74d
train
function
@typemap def to_sequence(x, sequence_lengths=None, sequence_axis_name_prefix='toSequence_', name=''): ''' This function converts 'x' to a sequence using the most significant static axis [0] as the sequence axis. The sequenceLengths input is optional; if unspecified, all sequences are assumed to be ...
@typemap def to_sequence(x, sequence_lengths=None, sequence_axis_name_prefix='toSequence_', name=''):
''' This function converts 'x' to a sequence using the most significant static axis [0] as the sequence axis. The sequenceLengths input is optional; if unspecified, all sequences are assumed to be of the same length; i.e. dimensionality of the most significant static axis Args: x: ...
cntk.ops.functions.Function: An instance of :class:`~cntk.ops.functions.Function` ''' from cntk.cntk_py import argmin x = sanitize_input(x) axis = sanitize_axis(axis) return argmin(x, axis, name) @typemap def to_sequence(x, sequence_lengths=None, sequence_axis_name_prefix='toSequence_', nam...
82
82
276
24
58
yuhonghong66/CNTK
bindings/python/cntk/ops/__init__.py
Python
to_sequence
to_sequence
3,397
3,429
3,397
3,398
5a8c5fab95a45d51b3eecc61dfe71e6b952c5320
bigcode/the-stack
train