def is_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 is_first operand = sanitize_input(operand, get_data_type(operand)) return is_first(operand, name)
def is_first(seq, name=''): ''' Returns a symbolic sequence of booleans with the same length as ``seq``. The first element of the sequence is 1 and all others are 0. Example: >>> x = C.input_variable(shape=(3,2)) >>> y = C.sequence.is_first(x) >>> x0 = np.reshape(np.arange(24.0,dtype=np.float32),(4,3,2)) >>> y.eval({x:x0}) array([[ 1., 0., 0., 0.]], 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 is_first seq = sanitize_input(seq, get_data_type(seq)) return is_first(seq, name)
def is_first(seq, name=''): ''' Returns a symbolic sequence of booleans with the same length as ``seq``. The first element of the sequence is 1 and all others are 0. Example: >>> x = C.input_variable(shape=(3,2)) >>> y = C.sequence.is_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([[ 1., 0., 0., 0.]], 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 is_first seq = sanitize_input(seq, get_data_type(seq)) return is_first(seq, name)