def test_invalid(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(array_ops.ones((1, 1, 1, 1)), axis_order) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt, axis_order[:-1]) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt, axis_order[::-1])
def test_invalid(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(tf.ones((1, 1, 1, 1)), axis_order) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt, axis_order[:-1]) with self.assertRaises(core.AxisOrderError): core.check_axis_order(lt, axis_order[::-1])
def test_passes(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(array_ops.ones((1, 1, 1, 1)), axis_order) core.check_axis_order(lt, axis_order) lt = core.LabeledTensor(array_ops.ones((1, 1, 1)), axis_order[1:]) core.check_axis_order(lt, axis_order) lt = core.LabeledTensor(array_ops.ones((1, 1, 1)), axis_order[:-1]) core.check_axis_order(lt, axis_order)
def test_passes(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(tf.ones((1, 1, 1, 1)), axis_order) core.check_axis_order(lt, axis_order) lt = core.LabeledTensor(tf.ones((1, 1, 1)), axis_order[1:]) core.check_axis_order(lt, axis_order) lt = core.LabeledTensor(tf.ones((1, 1, 1)), axis_order[:-1]) core.check_axis_order(lt, axis_order)
def test_scope(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(array_ops.ones((1, 1, 1, 1)), axis_order) with core.axis_order_scope(axis_order): core.check_axis_order(lt)
def test_scope(self): axis_order = ['w', 'x', 'y', 'z'] lt = core.LabeledTensor(tf.ones((1, 1, 1, 1)), axis_order) with core.axis_order_scope(axis_order): core.check_axis_order(lt)