def test_per_dim_mean_var_norm(): mean = np.asarray([2.], dtype=np.float32) inv_stddev = np.asarray([0.5], dtype=np.float32) x = C.input_variable((1, )) func = C.per_dim_mean_variance_normalize(x, mean, inv_stddev) result = func.eval({x: np.asarray([[3.], [1.]], dtype=np.float32)}) assert np.array_equal(result, [[.5], [-.5]])
def test_per_dim_mean_var_norm(): mean = np.asarray([2.], dtype=np.float32) inv_stddev = np.asarray([0.5], dtype=np.float32) x = C.input_variable((1,)) func = C.per_dim_mean_variance_normalize(x, mean, inv_stddev) result = func.eval({x : np.asarray([[3.], [1.]], dtype=np.float32)}) assert np.array_equal(result, [[.5], [-.5]])
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: per dimension mean to use for the normalization inv_stddev: per dimension standard deviation to use for the normalization name (str): the name of the node in the network Returns: :class:`cntk.Function` ''' from cntk import per_dim_mean_variance_normalize return per_dim_mean_variance_normalize(operand, mean, inv_stddev, name)
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: per dimension mean to use for the normalization inv_stddev: per dimension standard deviation to use for the normalization name (str): the name of the node in the network Returns: :class:`cntk.Function` ''' from cntk import per_dim_mean_variance_normalize return per_dim_mean_variance_normalize(operand, mean, inv_stddev, name)