apr_thread使用内存之谜 问题的起因是因为使用了一个apr的服务,产生了巨大的virtual memory,具体的表现是,在top中可以看到该进程的VIRT和RES,VIRT比实际上使用的要大很多。在google上找到如下文章怕有人访问不了,直接把原文贴在这里。...
opensips与对方tls sip trunk对接注意事项 opensips是一个强大的SBC,它支持多种底层协议; 如udp,tcp,以及基于tcp的tls,ws,wss等。在与基于tls的sip trunk对接时,需要注意以下几点:
【pytorch】使用numpy实现pytorch的softmax函数与cross_entropy函数 公式Softmax(xi)=exp(xi)∑jexp(xj){Softmax}(x_{i}) = \frac{\exp(x_i)}{\sum_j \exp(x_j)}Softmax(xi)=∑jexp(xj)exp(xi)结果一致从源码上来看,torch.nn.functional.F.softmax实际上调用的是Tensor自身的softmax函数公式Log_softmax(xi)=lnexp(xi)∑jexp(xj){Log\_softmax}(x_{i}) = ln
【pytorch异常处理】使用释放的图资源 【error】Trying to backward through the graph a second time, but the saved intermediate results have already been freedRuntimeError: Trying to backward through the graph a second time, but the saved intermediate results have already been freed. Specify reta
【matlab】一行中打印整个数组 在使用matlab时候,有时需要将数组打印出来,比较常用的是disp,可以直接输入数组打印。如下面的简单示例a=[1.10001,1.22222,-1.30303];disp(a);输出如下:但是如果需要打印到文件,或者指定格式打印呢,这个时候就不太适用了。当然有一种比较笨的方法,就是遍历数组打印。这不是不可以,只是实现上比较低效,下面就来介绍几种常用的可以在一行中打印数组的方法。方法1.该方法是先将数组中的数据转换成string,然后将string通过join来连接起来;打印数组也
centos如果有的repo失效,每次安装或者更新都会报错 centos如果有的repo失效,每次安装或者更新都会报错如有下面的错误http://files.freeswitch.org/yum-1.6/7/x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 - Not FoundTrying other mirror.To address this issue please refer to the below wiki article https://wiki.centos.org/yum-e
【pytorch】interpolate的简单使用 interpolate是用于做插值处理的,常见用途是用于上采样(upsampling);当然也是可以做下采样的(downsampling)官方的介绍如下参数列表如下简单使用下面做简单使用的介绍size和scale_factor两个参数只需要提供一个即可;他们的区别是,size指定了插值后的shape;而scale_factor只是提供一个系数去做倍增或者倍减;mode主要是指插值的算法,默认是"nearest", 它类似repeat操作,即复制最近的一个元素来实现插值,但是它必须适用于输入
【numpy】np.cumprod的使用 np.cumproduct 与 np.cumprod在numpy总存在两个计算累积乘积量的函数,cumproduct ,和cumprod在测试一些行为时,发现一致,然后看源码,cumproduct 就是cumprod。所以下面都以cumprod函数名讲解计算累积乘积量样例1t=np.array([1,2,3,4,5,6,7,8]).reshape([2,4])print(t)y=np.cumprod(t)print(y)如果不指定维度,那么所有维度都会压缩为1维计算样例2t=np
numpy的repeat和pytorch的repeat numpy的repeat重复数组中的元素样例1从某一个维度复制,如下面从第一维度复制,(2,3)的张量复制后就是(4,3)x = np.array([1,2,3,4,5,6]).reshape(2,3)print(x)print("===repeat====")# 也可以写作为# x = np.repeat(x, 2, axis=0)x = x.repeat(2, axis=0)print(x, x.shape)如果复制第二个维度呢,那么(2,3)的张量复制后就是(2,6),但是
Moment矩计算公式 平均数与标准方差这两个数学概念大家都耳熟能详,九年义务教育都涵盖的内容.假设有数组x, x1,x2,x3…xn, N 为数组的个数公式如下:μ=ΣxNσ=Σ(x−μ)2N\mu = \frac{\Sigma x} {N} ewline ewline\sigma = \frac{\Sigma (x-\mu)^2} {N} μ=NΣxσ=NΣ(x−μ)2它也叫做一阶矩和二阶矩高阶矩三阶矩和四阶矩公式如下:3rdmoment=1NΣ(x−μ)3σ34thmoment=1N
【tensorflow】tf.nn.embedding_lookup的使用 tf.nn.embedding_lookup即在给定的范围内做映射下面直接看例子样例1t = np.asarray([1,2,3,0])params = tf.constant([10,20,30,40])embedded_inputs = tf.nn.embedding_lookup(params, t)with tf.Session() as sess: print(sess.run(embedded_inputs))结果[20 30 40 10]可见结果即是按照t的顺
查询服务器上几张显卡命令 命令1nvidia-smi --query-gpu=name --format=csv,noheaderGeForce GTX 1080 TiGeForce GTX 1080 Ti命令2nvidia-smi --list-gpusGPU 0: GeForce GTX 1080 Ti (UUID: GPU-8bcfc794-ade2-b2da-af64-0f000b6537b8)GPU 1: GeForce GTX 1080 Ti (UUID: GPU-2c84b169-56f0-b2d1-2
【tensorflow】OP_REQUIRES failed at variable_ops.cc:104 Already exists: Resource 如下代码片段outputs = tf.keras.layers.Bidirectional(tf.keras.layers.GRU(units=half_depth, use_bias=False, return_sequences=True, return_state=False))(rnn_input)OP_REQUIRES failed at variable_ops.cc:104 Already exists: Resource在使用tensorflow 1.15版本
[tensorflow] tf.name_scope和tf.variable_scope name_scopeif __name__ == '__main__': with tf.name_scope("scope1"): v1 = tf.get_variable("var1", [1,2], dtype=tf.float32) v2 = tf.Variable(1, name="var2", dtype=tf.float32) v3 = tf.get_variable("var2", [1], dtype=tf.float32)
什么是CMU Pronoucing Dictionary(CMU发音词典) CMUdictCMU Pronoucing Dictionary一般会简写为CMUdict,CMU的含义是Carnegie Mellon University(卡耐基梅隆大学)的缩写。CMUdict的第一个版本是卡耐基梅隆大学在1993年发布的,在其0.7a版本后,2008年后采用了BSD license。Phoneme Set 音素集合一共有39个基本音素(未包含变种)PhoneExampleTranslationAAoddAA DAEatAE TAHh
编译phonetisaurus时configure找不到openfst的问题解决 PhonetisaurusPhonetisaurus是用于做g2p(grapheme to phoneme)的工具,它的源码地址在这里。编译它的编译依赖openfst,在编译openfst时,如果不指定构建路径在系统路径下,生成的include和lib可能就无法被直接引用到。所以在编译Phonetisaurus时,特别是在configure步骤,会提示依赖的openfst找不到。checking for openfst libraries... configure: error: Can't fi
【sox】常用的音频处理脚本合集一 批量计算wav文件时长#!/bin/bashif [ $# != 1 ];then echo "specify the dir to do the calculation." exitfioutput_tmp="$1.tmp"output="$1.file_duration"for file in $1/*.wavdo dur=`soxi -d ${file}` Dur=`soxi -D ${file}` echo "$file $dur $Dur