MCPcopy Create free account
hub / github.com/pytorch/pytorch / testConcatNCHW

Method testConcatNCHW

caffe2/python/gradient_check_test.py:137–159  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135 self.assertTrue(res)
136
137 def testConcatNCHW(self):
138 for input_size, d1, d2, d3, d4 in self.test_configs:
139 op = core.CreateOperator("Concat",
140 ["X1", "X2", "X3", "X4"],
141 ["Y", "Y_dims"],
142 order="NCHW"
143 )
144 Xs = [
145 np.random.rand(2, d1, input_size,
146 input_size).astype(np.float32),
147 np.random.rand(2, d2, input_size,
148 input_size).astype(np.float32),
149 np.random.rand(2, d3, input_size,
150 input_size).astype(np.float32),
151 np.random.rand(2, d4, input_size, input_size).astype(np.float32)
152 ]
153 for i in range(4):
154 res = device_checker.CheckSimple(op, Xs, [0])
155 self.assertTrue(res)
156 for checker in gradient_checkers:
157 res, grad, grad_estimated = checker.CheckSimple(op, Xs, i,
158 [0])
159 self.assertTrue(res)
160
161
162class TestRelu(test_util.TestCase):

Callers

nothing calls this directly

Calls 4

astypeMethod · 0.80
rangeFunction · 0.50
randMethod · 0.45
CheckSimpleMethod · 0.45

Tested by

no test coverage detected