def test_tuple_value(): tv = TupleValue(Value.from_scalar( 1), Value.from_scalar(2), Value.from_scalar(3)) np.testing.assert_allclose(tv[0].asnumpy(), 1) np.testing.assert_allclose(tv[1].asnumpy(), 2) np.testing.assert_allclose(tv[2].asnumpy(), 3)
def test_tuple_value(): tv = TupleValue(Value.from_scalar(1), Value.from_scalar(2), Value.from_scalar(3)) np.testing.assert_allclose(tv[0].asnumpy(), 1) np.testing.assert_allclose(tv[1].asnumpy(), 2) np.testing.assert_allclose(tv[2].asnumpy(), 3)
def test_from_scalar(): np.testing.assert_allclose(Value.from_scalar(1, 'int32').asnumpy(), 1) np.testing.assert_allclose(Value.from_scalar(10.0, 'float32').asnumpy(), 10.0) np.testing.assert_allclose(Value.from_scalar(True).asnumpy(), True)
def test_from_scalar(): np.testing.assert_allclose(Value.from_scalar(1, 'int32').asnumpy(), 1) np.testing.assert_allclose( Value.from_scalar(10.0, 'float32').asnumpy(), 10.0) np.testing.assert_allclose(Value.from_scalar(True).asnumpy(), True)