Create bbpf.py

This commit is contained in:
PSBigBig 2025-06-10 17:28:30 +08:00 committed by GitHub
parent 240e9af68f
commit 705d6b7db2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

11
wfgy_sdk/bbpf.py Normal file
View file

@ -0,0 +1,11 @@
import numpy as np
def perturb_state(x, epsilon=0.1, num_paths=3):
"""Return list of perturbed states"""
return [x + np.random.normal(0, epsilon, size=x.shape) for _ in range(num_paths)]
def run_demo():
x = np.array([1.0, 2.0, 3.0])
paths = perturb_state(x)
for i, p in enumerate(paths):
print(f"Path {i+1}: {p}")