def testTensorConversion(self): class TupleToTensor(training.Model): def __init__(self): super(TupleToTensor, self).__init__() self.l = (1., 2., 3.) self.assertAllEqual( (1., 2., 3.), self.evaluate(constant_op.constant(TupleToTensor().l))) self.assertAllEqual( (1., 2., 3.), self.evaluate(gen_array_ops.Pack(values=TupleToTensor().l)))
def testTensorConversion(self): class ListToTensor(training.Model): def __init__(self): super(ListToTensor, self).__init__() self.l = [1., 2., 3.] self.assertAllEqual([1., 2., 3.], self.evaluate( constant_op.constant(ListToTensor().l))) self.assertAllEqual([1., 2., 3.], self.evaluate( gen_array_ops.Pack(values=ListToTensor().l)))