# Model criticism API (ed.copy): possible to copy multiple model components at once?

**URL:** <https://discourse.edwardlib.org/t/model-criticism-api-ed-copy-possible-to-copy-multiple-model-components-at-once/75>\
**Category:** General\
**Created:** [April 10, 2017, 6:00pm UTC](https://discourse.edwardlib.org/t/model-criticism-api-ed-copy-possible-to-copy-multiple-model-components-at-once/75 "2017-04-10T18:00:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mariru](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.edwardlib.org/mariru/32/25_2.png) [@mariru](https://discourse.edwardlib.org/u/mariru)\
**Post date:** [April 10, 2017, 6:00pm UTC](https://discourse.edwardlib.org/t/model-criticism-api-ed-copy-possible-to-copy-multiple-model-components-at-once/75/1 "2017-04-10T18:00:28Z")

</div>

For the model criticism API it could be useful to be able to copy multiple model components at once.

Consider this toy example:

```auto
q = Normal(...)

a = Normal(f(q))

b = Normal(g(q))

```

q are your latent variables and a and b are observed (g and f are some functions). Now say you do inference with a variational model q tied to qz ({q: qz}). Finally you want to criticize the model.

```auto
a_post = ed.copy(a, {q: qz})
b_post = ed.copy(b, {q: qz})
...

```

It could be nice to allow a list of random variables or tensors as input to ed.copy() so that nodes that are shared in the computational graph say downstream from qz do not have to be copied twice. (e.g. f and g could be large neural networks which share parameters)

---

<div class="post-metadata">

**Author:** ![dustin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.edwardlib.org/dustin/32/134_2.png) [@dustin](https://discourse.edwardlib.org/u/dustin)\
**Post date:** [April 10, 2017, 7:39pm UTC](https://discourse.edwardlib.org/t/model-criticism-api-ed-copy-possible-to-copy-multiple-model-components-at-once/75/2 "2017-04-10T19:39:18Z")

</div>

That makes sense. It’s an easy change to the internals in `ed.copy` to handle lists.
