Skip to content

Commit c7d918f

Browse files
fix tf cast warnings
1 parent fc4fd41 commit c7d918f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,19 @@
1616

1717
- Add end to end infrastructures and methods for classical shadow in `shadows.py`
1818

19+
- Add classical shadow tutorial
20+
21+
- Add NN-VQE tutorial
22+
1923
### Fixed
2024

2125
- improve the `adaptive_vmap` to support internal jit and pytree output
2226

23-
- fix `pauli_gates` dtype unchange issue when set new dtype (not recommend to use this property)
27+
- fix `pauli_gates` dtype unchange issue when set new dtype (not recommend to use this attr anymore)
2428

2529
- fix rem `apply_correction` bug when non-numpy backend is set
30+
31+
- fix tf warning for `cast` with higher version of tf
2632
### Changed
2733

2834
- The static method `BaseCircuit.copy` is renamed as `BaseCircuit.copy_nodes` (breaking changes)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ We also have [Docker support](/docker).
205205

206206
- Reusable common circuit/measurement/problem templates and patterns.
207207

208+
- Jittable classical shadow infrastructures.
209+
208210
- SOTA quantum algorithm and model implementations.
209211

210212
- Support hybrid workflows and pipelines with CPU/GPU/QPU hardware from local/cloud/hpc resources using tf/torch/jax/cupy/numpy frameworks all at the same time.

tensorcircuit/backends/tensorflow_backend.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# pylint: disable=invalid-name
55

66
import os
7+
import re
78
from functools import reduce, partial
89
from operator import mul
910
from typing import Any, Callable, Optional, Sequence, Tuple, Union
@@ -378,6 +379,9 @@ def __init__(self) -> None:
378379
tf.sparse.SparseTensor.__add__ = tf.sparse.add
379380
self.minor = int(tf.__version__.split(".")[1])
380381
self.name = "tensorflow"
382+
logger = tf.get_logger() # .setLevel('ERROR')
383+
logger.addFilter(lambda s: not re.match(".*You are casting.*", s.getMessage()))
384+
# ignore casting warning by logger
381385

382386
def eye(
383387
self, N: int, dtype: Optional[str] = None, M: Optional[int] = None

0 commit comments

Comments
 (0)