lgone2000
lgone2000
版本为paddlepaddle_gpu-0.14.0.post87-cp27-cp27mu-manylinux1_x86_64.whl 测试程序如下 其中 如果place为cpu,可以正常输出,改成gpu则core。老版本0.13 可以正常跑 ``` def testpaddle014(): place = fluid.CUDAPlace(0) #place = fluid.CPUPlace() print 'version', paddle.__version__, place input = fluid.layers.data(name='input', shape=[3,50,50], dtype='float32') output = fluid.layers.conv2d(input=input,num_filters=1,filter_size=3,stride=1,padding=1,groups=1,act=None) #output = fluid.layers.fc(input=input,size=2) fetch_list...
复现代码如下。虽然和qingqing沟通可以绕过,但还是希望这个要当作bug解决。 ``` def testscale(): x = fluid.layers.data(name='x', shape=[1], dtype='float32') y = x * 2 z = paddle.fluid.layers.scale(x, 2) place = fluid.CPUPlace() exe = fluid.Executor(place) exe.run(fluid.default_startup_program()) inputdata = np.array([1],np.float32) output =...
 ``` def testeditdistance(): x = fluid.layers.data(name='x', shape=[8], dtype='float32') y = fluid.layers.data(name='y', shape=[7], dtype='float32') cost = fluid.layers.edit_distance(input=x,label=y) ``` 报错 paddle.fluid.core.EnforceNotMet: Input(Hyps) must be a 2-D LoDTensor with the 2nd dimension...
在下面函数中,avg_instance_error = self.instance_error / self.seq_num 除法两个变量都是整数,得到结果为0 ``` def eval(self): if self.seq_num == 0: raise ValueError( "There is no data in EditDistance Metric. Please check layers.edit_distance output has been added to...
目前paddle内存池采用预分配,用nvidia-smi 查看不了显存使用情况。 主要需要用于查看 跟进显存使用情况,来设定训练batch大小。也可以用于查找显存或者内存泄露
fluid的layers 大部分都支持name参数,为啥有个别的不支持?
在使用图像分类训练时,有一个参数是指定预训练模型。 https://github.com/PaddlePaddle/models/blob/53ea0f3186504a9c619651ce862fa576a9144424/PaddleCV/image_classification/train.py#L291 ``` if pretrained_model: def if_exist(var): return os.path.exists(os.path.join(pretrained_model, var.name)) fluid.io.load_vars( exe, pretrained_model, main_program=train_prog, predicate=if_exist) ``` 这段代码如果载入了之前训练的模型,有可能也同时载入了一个**@LR_DECAY_COUNTER@** 的变量 [(参考文档)](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#autoincreased-step-counter) , 会导致learningratedecay策略使用预训练模型里面保存的计数器,而不是从0开始,这个和通常训练预期不符合。经过咨询paddle同学,可以改成如下形式,通过限制载入条件,避免加载这个变量。 ``` if pretrained_model: def check_var(var): exists = os.path.exists(os.path.join(pretrained_model, var.name))...
测试代码如下 ``` def test_metric_loss(): place = fluid.CPUPlace() exe = fluid.Executor(place) main_program = fluid.default_main_program() x = fluid.layers.data(name='x', shape=[10], dtype='float32') feature = fluid.layers.fc(input=x, size=20, act=None) batch_size = 6 samples_each_class = 2 pos,...
``` def test_ignore(): input = fluid.layers.data(name='input', shape=[5], dtype='float32') out = fluid.layers.fc(input=input, size=2) label = fluid.layers.data(name='label', shape=[1], dtype='int64') loss = fluid.layers.softmax_with_cross_entropy(out, label, ignore_index=-100) place = fluid.CPUPlace() #place = fluid.CUDAPlace(0) exe =...
文档为 http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#topk 测试代码如下 ``` def test_top(): input = fluid.layers.data(name='input', shape=[5], dtype='float32') # this can't work , reshapeinput = fluid.layers.reshape(input,[-1]) #this can work #reshapeinput = fluid.layers.reshape(input,[1,-1]) topval, topindex = fluid.layers.topk(reshapeinput, k...