Did I find the right examples for you? yes no

sympy.printing.theanocode.dim_handling

All Samples(8)  |  Call(6)  |  Derive(0)  |  Import(2)
```Handle various input types for dimensions in tensor_wrap

tensor_wrap
theano_funciton
```

```        def dim_handling(inputs, dim=None, dims={}, broadcastables={}, keys=(),
**kwargs):
""" Handle various input types for dimensions in tensor_wrap

tensor_wrap
theano_funciton
"""
if dim:
dims = dict(zip(inputs, [dim]*len(inputs)))
if dims:
maxdim = max(dims.values())
broadcastables = dict((i, (False,)*dims[i] + (True,)*(maxdim-dims[i]))
for i in inputs)
```

```sy = sympy
from sympy.abc import x, y, z, a, b, c
from sympy.printing.theanocode import (theano_code, dim_handling,
theano_function)

```
```def test_dim_handling():
assert dim_handling([x], dim=2) == {x: (False, False)}
assert dim_handling([x, y], dims={x: 1, y: 2}) == {x: (False, True),
y: (False, False)}
assert dim_handling([x], broadcastables={x: (False,)}) == {x: (False,)}
```

```sy = sympy
from sympy.abc import x, y, z, a, b, c
from sympy.printing.theanocode import (theano_code, dim_handling,
theano_function)

```
```def test_dim_handling():
assert dim_handling([x], dim=2) == {x: (False, False)}
assert dim_handling([x, y], dims={x: 1, y: 2}) == {x: (False, True),
y: (False, False)}
assert dim_handling([x], broadcastables={x: (False,)}) == {x: (False,)}
```