Skip to content

Commit a81b353

Browse files
authored
Merge pull request #3417 from reyoung/feature/remove_fc_op_in_cpp
Remove FC Op, since it should be added in Python side Fix #3418
2 parents 7e8c337 + 9a592ec commit a81b353

File tree

7 files changed

+19
-133
lines changed

7 files changed

+19
-133
lines changed

paddle/framework/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ if(WITH_PYTHON)
4848
cc_library(paddle_pybind SHARED
4949
SRCS pybind.cc
5050
DEPS pybind python backward
51-
fc_op
5251
sgd_op
5352
add_op
53+
mul_op
54+
rowwise_add_op
55+
sigmoid_op
56+
softmax_op
5457
mean_op
5558
cross_entropy_op
5659
recurrent_op

paddle/framework/pybind.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ namespace py = pybind11;
3131

3232
USE_OP(add_two);
3333
USE_OP_CPU(onehot_cross_entropy);
34-
USE_OP_WITHOUT_KERNEL(fc);
3534
USE_OP(sgd);
3635
USE_OP(mul);
3736
USE_OP(mean);

paddle/operators/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ op_library(fill_zeros_like_op SRCS fill_zeros_like_op.cc fill_zeros_like_op.cu)
6161

6262
op_library(sgd_op SRCS sgd_op.cc sgd_op.cu)
6363

64-
op_library(fc_op
65-
SRCS fc_op.cc
66-
DEPS mul_op rowwise_add_op sigmoid_op softmax_op net_op)
6764
op_library(recurrent_op SRCS recurrent_op.cc rnn/recurrent_op_utils.cc
6865
DEPS op_desc tensor op_registry operator net_op)
6966
cc_test(recurrent_op_test SRCS recurrent_op_test.cc DEPS recurrent_op gtest mul_op add_op)

paddle/operators/fc_op.cc

Lines changed: 0 additions & 76 deletions
This file was deleted.

python/paddle/v2/framework/tests/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
py_test(test_net SRCS test_net.py)
22

3-
py_test(test_fc_op SRCS test_fc_op.py)
43
py_test(test_scope SRCS test_scope.py)
54

65
py_test(test_tensor SRCS test_tensor.py)

python/paddle/v2/framework/tests/test_fc_op.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

python/paddle/v2/framework/tests/test_net.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,34 @@
33
import unittest
44

55

6+
def fc(X, W, Y):
7+
ret_v = core.Net.create()
8+
9+
ret_v.add_op(Operator("mul", X="X", Y="W", Out="pre_activation"))
10+
ret_v.add_op(Operator("sigmoid", X="pre_activation", Y=Y))
11+
ret_v.complete_add_op(True)
12+
return ret_v
13+
14+
615
class TestNet(unittest.TestCase):
716
def test_net_all(self):
817
net = core.Net.create()
918
op1 = Operator("add_two", X="X", Y="Y", Out="Out")
1019
net.add_op(op1)
1120

1221
net2 = core.Net.create()
13-
net2.add_op(Operator("fc", X="X", W="w", Y="fc.out"))
22+
net2.add_op(fc(X="X", W="w", Y="fc.out"))
1423
net2.complete_add_op(True)
1524
net.add_op(net2)
1625
net.complete_add_op(True)
1726

1827
expected = '''
19-
Op(plain_net), inputs:(@EMPTY@, X, Y, w), outputs:(@TEMP@fc@0, Out, fc.out).
28+
Op(plain_net), inputs:(W, X, Y), outputs:(Out, fc.out, pre_activation).
2029
Op(add_two), inputs:(X, Y), outputs:(Out).
21-
Op(plain_net), inputs:(@EMPTY@, X, w), outputs:(@TEMP@fc@0, fc.out).
22-
Op(fc), inputs:(X, w, @EMPTY@), outputs:(fc.out, @TEMP@fc@0).
23-
Op(mul), inputs:(X, w), outputs:(@TEMP@fc@0).
24-
Op(sigmoid), inputs:(@TEMP@fc@0), outputs:(fc.out).
30+
Op(plain_net), inputs:(W, X), outputs:(fc.out, pre_activation).
31+
Op(plain_net), inputs:(W, X), outputs:(fc.out, pre_activation).
32+
Op(mul), inputs:(X, W), outputs:(pre_activation).
33+
Op(sigmoid), inputs:(pre_activation), outputs:(fc.out).
2534
'''
2635
self.assertEqual(expected, "\n" + str(net))
2736

0 commit comments

Comments
 (0)