示例#1
0
文件: __init__.py 项目: hahatt/CNTK
def first(operand, name=''):
    '''
    TBA

    Example:
        TBA
    Args:        
        operand: the symbolic tensor operand denoting a sequence
        name (str): the name of the node in the network
    Returns:
        :class:`cntk.Function`
    '''
    from cntk.cntk_py import first
    operand = sanitize_input(operand, get_data_type(operand))
    return first(operand, name)
示例#2
0
def first(operand, name=''):
    '''
    TBA
        
    Example:
        TBA
    Args:        
        operand: the symbolic tensor operand denoting a sequence
        name (str): the name of the node in the network
    Returns:
        :class:`cntk.Function`
    '''
    from cntk.cntk_py import first
    operand = sanitize_input(operand, get_data_type(operand))
    return first(operand, name)
示例#3
0
def reduce_max(x, name=''):
  """
  Get the max value in the sequence values

  Args:
    x: input sequence
    name: the name of the operator
  Returns:
    The max value in the input sequence
  """
  from ...ops import past_value, future_value, element_select, placeholder, greater 
  m = placeholder(shape=(1,), dynamic_axes = x.dynamic_axes, name='max')
  o = element_select(greater(x, future_value(m)), x, future_value(m))
  rlt = o.replace_placeholders({m:sanitize_input(o)})
  max_out = first(rlt) 
  return sanitize_input(max_out)
示例#4
0
def first(seq, name=''):
    '''
    Returns the first element of its symbolic input sequence ``seq``

    Example:
        >>> x = C.input_variable(shape=(3,2))
        >>> y = C.sequence.first(x)
        >>> x0 = np.reshape(np.arange(24.0,dtype=np.float32),(4,3,2))
        >>> y.eval({x:x0})
        array([[[[ 0.,  1.],
                 [ 2.,  3.],
                 [ 4.,  5.]]]], dtype=float32)

    Args:
        seq: the symbolic tensor denoting a sequence
        name (str): the name of the node in the network
    Returns:
        :class:`~cntk.ops.functions.Function`
    '''
    from cntk.cntk_py import first
    seq = sanitize_input(seq, get_data_type(seq))
    return first(seq, name)
示例#5
0
def first(seq, name=''):
    '''
    Returns the first element of its symbolic input sequence ``seq``

    Example:
        >>> x = C.input_variable(shape=(3,2))
        >>> y = C.sequence.first(x)
        >>> # create one sequence of 4 tensors each with shape (3,2)
        >>> x0 = np.reshape(np.arange(24.0,dtype=np.float32),(1,4,3,2))
        >>> y.eval({x:x0})
        array([[[[ 0.,  1.],
                 [ 2.,  3.],
                 [ 4.,  5.]]]], dtype=float32)

    Args:
        seq: the symbolic tensor denoting a sequence
        name (str): the name of the node in the network
    Returns:
        :class:`~cntk.ops.functions.Function`
    '''
    from cntk.cntk_py import first
    seq = sanitize_input(seq, get_data_type(seq))
    return first(seq, name)