def test_variable_convert_to_tensor_with_dtype(self):
        """Test converting a variable to a tensor with a dtype."""
        v = backend.Variable(initializer=np.array([1.0, 2.0, 3.0]))
        self.assertAllClose(
            v._convert_to_tensor(v.value, dtype="float32"),
            np.array([1.0, 2.0, 3.0]),
        )
Test converting a variable to a tensor with a dtype.
keras/src/backend/common/variables_test.py