parent
bb7f34594c
commit
1e676f684d
@ -1,4 +1,5 @@
|
|||||||
#include "paddle/framework/op_registry.h"
|
#define EIGEN_USE_GPU
|
||||||
|
|
||||||
#include "paddle/operators/mean_op.h"
|
#include "paddle/operators/mean_op.h"
|
||||||
|
|
||||||
REGISTER_OP_GPU_KERNEL(mean, ops::AddKernel<ops::GPUPlace, float>);
|
REGISTER_OP_GPU_KERNEL(mean, ops::MeanKernel<ops::GPUPlace, float>);
|
||||||
|
@ -1,2 +1,9 @@
|
|||||||
cc_library(paddle_pybind SHARED SRCS pybind.cc DEPS pybind python
|
cc_library(paddle_pybind SHARED
|
||||||
add_op fc_op sgd_op cross_entropy_op recurrent_network_op)
|
SRCS pybind.cc
|
||||||
|
DEPS pybind python
|
||||||
|
fc_op
|
||||||
|
sgd_op
|
||||||
|
add_op
|
||||||
|
mean_op
|
||||||
|
cross_entropy_op
|
||||||
|
recurrent_network_op)
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import unittest
|
||||||
|
from op_test_util import OpTestMeta
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
|
||||||
|
class TestMeanOp(unittest.TestCase):
|
||||||
|
__metaclass__ = OpTestMeta
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.type = "mean"
|
||||||
|
self.X = np.random.random((32, 784)).astype("float32")
|
||||||
|
self.Out = np.mean(self.X)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
Loading…
Reference in new issue