Exemple #1
0
 def test3d(self):
   input_tensor = constant_op.constant([[[1, 2]], [[3, 4]]])
   expected_output_array = [[[1, 2], [0, 0]], [[3, 4], [0, 0]]]
   op = loss_functions.insert_slice_in_zeros(input_tensor, 1, 2, 0)
   with self.test_session() as sess:
     actual_output_array = sess.run(op)
   self.assertAllEqual(expected_output_array, actual_output_array)
Exemple #2
0
 def testBadShape(self):
   bad_shaped_ones = array_ops.ones(shape=[1, 3])  # n.b. shape[1] != 1
   with self.assertRaises(ValueError):
     loss_functions.insert_slice_in_zeros(bad_shaped_ones, 1, 42, 17)