# Possible extensions of total\_size

**URL:** <https://discourse.pymc.io/t/possible-extensions-of-total-size/36>\
**Category:** Questions\
**Tags:** from\_github\
**Created:** [June 13, 2017, 1:58pm UTC](https://discourse.pymc.io/t/possible-extensions-of-total-size/36 "2017-06-13T13:58:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![junpenglao](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/junpenglao/32/8_2.png) [@junpenglao](https://discourse.pymc.io/u/junpenglao)\
**Post date:** [June 13, 2017, 1:58pm UTC](https://discourse.pymc.io/t/possible-extensions-of-total-size/36/1 "2017-06-13T13:58:21Z")

</div>

[Github issue #2125](https://github.com/pymc-devs/pymc3/issues/2125) by [pwl](https://github.com/pwl):

I have some trouble understanding the `total_size` parameter and there is no mention of it in the docs. From the examples I have seen so far the parameter should be set to the total size of the training data when doing mini-batch training. This is simple to interpret if the data is just a 1d array but what should I put in there if I’m training a model on views of 2d data (subsampling in both dimensions)? Should I then use `total_size=data.shape[0]*data.shape[1]`?

From the gitter conversation it seems that total\_size for subsampling in more then 1 dimensions needs some extra support on the pymc3 side. @ferrine suggested the following API:

```python
total_size = int # for shape[0] subsampling
total_size = [int, None, int] # for subsampling [shape[0], shape[2]]
total_size = [int, Ellipsis, int] # for subsampling [shape[0], shape[-1]]

```

In my 2d case I would write `total_size = [data.shape[0], data.shape[1]]`.

---

<div class="post-metadata">

**Author:** ![ferrine](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ferrine/32/10_2.png) [@ferrine](https://discourse.pymc.io/u/ferrine)\
**Post date:** [June 13, 2017, 2:17pm UTC](https://discourse.pymc.io/t/possible-extensions-of-total-size/36/2 "2017-06-13T14:17:28Z")

</div>

The most robust way is using `total_size=data.shape`

---

<div class="post-metadata">

**Author:** ![ferrine](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.pymc.io/ferrine/32/10_2.png) [@ferrine](https://discourse.pymc.io/u/ferrine)\
**Post date:** [June 13, 2017, 2:19pm UTC](https://discourse.pymc.io/t/possible-extensions-of-total-size/36/3 "2017-06-13T14:19:56Z")

</div>

It will be working fine for all types of RVs except `MultiObserved` RV, there I rely on `logp_elemwice.shape`
