| Conditions | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | #!/usr/bin/env python |
||
| 7 | def create_var(theano_tensor, dim=0, test_shape=None, test_dtype=FLOATX): |
||
| 8 | """ |
||
| 9 | Wrap a Theano tensor into the variable for defining neural network. |
||
| 10 | :param dim: last dimension of tensor, 0 indicates that the last dimension is flexible |
||
| 11 | :rtype: TensorVar |
||
| 12 | """ |
||
| 13 | from deepy.layers.variable import NeuralVar |
||
| 14 | var = NeuralVar(dim, theano_tensor) |
||
| 15 | if test_shape: |
||
| 16 | var.set_test_value(np.random.rand(*test_shape).astype(test_dtype)) |
||
| 17 | return var |