def testL1Loss(self): with self.test_session(): shape = [5, 5, 5] num_elem = 5 * 5 * 5 weights = tf.constant(1.0, shape=shape) wd = 0.01 loss = losses.l1_loss(weights, wd) self.assertEqual(loss.op.name, 'L1Loss/value') self.assertAlmostEqual(loss.eval(), num_elem * wd, 5)
def testL1Loss(self): with self.test_session(): shape = [5, 5, 5] num_elem = 5 * 5 * 5 weights = tf.constant(1.0, shape=shape) wd = 0.01 loss = losses.l1_loss(weights, wd) self.assertEquals(loss.op.name, 'L1Loss/value') self.assertAlmostEqual(loss.eval(), num_elem * wd, 5)