def check_forward(self, x_data, W_data, b_data): # Check only data type, y is tested by SimplifiedDropconnect link test. x = chainer.Variable(x_data) W = chainer.Variable(W_data) if b_data is None: y = functions.simplified_dropconnect(x, W, None, self.ratio, self.train) else: b = chainer.Variable(b_data) y = functions.simplified_dropconnect(x, W, b, self.ratio, self.train) self.assertEqual(y.data.dtype, self.x_dtype)
def check_forward(self, x_data, W_data, b_data): # Check only data type, y is tested by SimplifiedDropconnect link test. x = chainer.Variable(x_data) W = chainer.Variable(W_data) if b_data is None: y = functions.simplified_dropconnect(x, W, None, self.ratio, self.train, None, self.use_batchwise_mask) else: b = chainer.Variable(b_data) y = functions.simplified_dropconnect(x, W, b, self.ratio, self.train, None, self.use_batchwise_mask) self.assertEqual(y.data.dtype, self.x_dtype) mask = y.creator.mask mask = cuda.to_cpu(mask) if self.use_batchwise_mask: self.assertEqual(mask.shape, (x.shape[0],) + W.shape) else: self.assertEqual(mask.shape, W.shape)
def check_forward(self, x_data, W_data, b_data): # Check only data type, y is tested by SimplifiedDropconnect link test. x = chainer.Variable(x_data) W = chainer.Variable(W_data) if b_data is None: y = functions.simplified_dropconnect(x, W, None, self.ratio, self.train, None, self.use_batchwise_mask) else: b = chainer.Variable(b_data) y = functions.simplified_dropconnect(x, W, b, self.ratio, self.train, None, self.use_batchwise_mask) self.assertEqual(y.data.dtype, self.x_dtype) mask = y.creator.mask mask = cuda.to_cpu(mask) if self.use_batchwise_mask: self.assertEqual(mask.shape, (x.shape[0], ) + W.shape) else: self.assertEqual(mask.shape, W.shape)
def f(x, W, b=None): return functions.simplified_dropconnect( x, W, b, self.ratio, self.train, mask, self.use_batchwise_mask)
def f(x, W, b=None): y = functions.simplified_dropconnect(x, W, b, self.ratio, self.train, mask, self.use_batchwise_mask) return y * y