# How to create this Bijector with tfb

**URL:** <https://discuss.ai.google.dev/t/how-to-create-this-bijector-with-tfb/29027>\
**Category:** General Discussion\
**Tags:** help\_request\
**Created:** [September 19, 2022, 3:22am UTC](https://discuss.ai.google.dev/t/how-to-create-this-bijector-with-tfb/29027 "2022-09-19T03:22:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jecampagne](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/jecampagne/32/11292_2.png) [@jecampagne](https://discuss.ai.google.dev/u/jecampagne)\
**Post date:** [September 19, 2022, 3:22am UTC](https://discuss.ai.google.dev/t/how-to-create-this-bijector-with-tfb/29027/1 "2022-09-19T03:22:07Z")

</div>

Hello,  
I am quite new in the field and in the use TF, so I probably ask a rather easy question, but I was wandering  
how I can implement this transformation as a Bijector (all the “w” and “alpha” are \>0)  
$$T(z\_i) = w\_{i0} + \sum\_{k=1}^K w\_{ik}\rho(\alpha\_{ik} z\_i + \beta\_{ik})$$  
this is just to illustrate an how-to, for instance K=2 and z\_i is either a 1-scalar feature or a 2-scalar features.  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![lenny\_burkdoll](https://d1dlmcr85iqnpo.cloudfront.net/user_avatar/discuss.ai.google.dev/lenny_burkdoll/32/12966_2.png) [@lenny\_burkdoll](https://discuss.ai.google.dev/u/lenny_burkdoll)\
**Post date:** [September 19, 2022, 6:51am UTC](https://discuss.ai.google.dev/t/how-to-create-this-bijector-with-tfb/29027/3 "2022-09-19T06:51:19Z")

</div>

- import tensorflow as tf import tensorflow\_probability as tfp **tfd = tfp.distributions** tfb = tfp.bijectors base\_distribution = tfd.Normal (loc=0, scale=1.5) x = base\_distribution.sample (10) # Sample 10 times, to get fixed values # Define the distribution for the parameter of the bijector scale\_distribution = tfd.Uniform (low=2/3-0.5, high=2/3+0.5) # This is how I wish it was, but fails bijector = tfb.Scale (scale=scale\_distribution) # ValueError: TypeError: object of type ‘Uniform’ has no len ()  
(_Removed by moderator_)
