diff --git a/paddle/operators/fc_op.cc b/paddle/operators/fc_op.cc index ec76d6c6597e5ca2cf1e119d361e24f5655cc854..6e6a09bc3fbe41e1a2d70dc570c1cfc084f1a01b 100644 --- a/paddle/operators/fc_op.cc +++ b/paddle/operators/fc_op.cc @@ -37,7 +37,7 @@ class FCOp : public NetOp { // mul_out = X[0] * W[0] + ... + X[n-1] * W[n-1] AppendOp( - framework::OpRegistry::CreateOp("mul", {{"X", {x[0]}}, {"W", {w[0]}}}, + framework::OpRegistry::CreateOp("mul", {{"X", {x[0]}}, {"Y", {w[0]}}}, {{"Out", {Output("mul_out")}}}, {})); for (int i = 1; i < n; i++) { @@ -68,6 +68,8 @@ class FCOp : public NetOp { AppendOp(framework::OpRegistry::CreateOp( activation, {{"X", {Output(add_out)}}}, {{"Y", {Output("Y")}}}, {})); CompleteAddOp(false); + + std::cout << DebugString() << std::endl; } }; diff --git a/python/paddle/v2/framework/tests/op_test.py b/python/paddle/v2/framework/tests/op_test.py index 3a6a5dca4c4ddc1399d80e491e4072f24707c01e..b524f88551f7547a4787d7e1b589a0b9143582dc 100644 --- a/python/paddle/v2/framework/tests/op_test.py +++ b/python/paddle/v2/framework/tests/op_test.py @@ -36,8 +36,8 @@ def create_op(scope, op_type, inputs, outputs, attrs=None): var = scope.new_var(out_name) kwargs[out_name].append(out_name) - for attr_name in Operator.get_op_attr_names(op_type): - kwargs[attr_name] = attrs[attr_name] + #for attr_name in Operator.get_op_attr_names(op_type): + # kwargs[attr_name] = attrs[attr_name] return Operator(op_type, **kwargs) @@ -186,14 +186,14 @@ class OpTest(unittest.TestCase): self.assertTrue( np.allclose( actual, expect, atol=1e-05), - "output name: " + out_name + "has diff") + "output name: " + out_name + " has diff") else: actual = np.array(self.scope.find_var(out_name).get_tensor()) expect = self.outputs[out_name] self.assertTrue( np.allclose( actual, expect, atol=1e-05), - "output name: " + out_name + "has diff") + "output name: " + out_name + " has diff") def check_output(self): places = [core.CPUPlace()] diff --git a/python/paddle/v2/framework/tests/test_fc_op.py b/python/paddle/v2/framework/tests/test_fc_op.py index 72d750111c55c4bc44defabc36a1abdeed2695e7..959bd7e405b9cc25e0a9602b1c67f03c5dd557b6 100644 --- a/python/paddle/v2/framework/tests/test_fc_op.py +++ b/python/paddle/v2/framework/tests/test_fc_op.py @@ -1,8 +1,6 @@ import unittest import numpy as np from op_test import OpTest -import paddle.v2.framework.core as core -from paddle.v2.framework.op import Operator class TestFCOp(OpTest): @@ -37,8 +35,7 @@ class TestFCOp(OpTest): } def test_check_output(self): - self.check_output(core.CPUPlace()) - self.check_output(core.GPUPlace(0)) + self.check_output() #def test_check_grad(self): # self.check_grad(["X0", "X1", "W0", "W1", "b"], "Y")