| Conditions | 9 |
| Total Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | #!/usr/bin/env python |
||
| 12 | def __init__(self, input_dim=0, model=None, input_tensor=None, |
||
| 13 | cost=None, output=None, blocks=None, input_vars=None, target_vars=None): |
||
| 14 | """ |
||
| 15 | Create a basic network. |
||
| 16 | |||
| 17 | Parameters: |
||
| 18 | input_dim - dimension of input variable |
||
| 19 | model - a short hand to specify the model |
||
| 20 | config - network configuration |
||
| 21 | input_tensor - specify the tensor of input if it's special |
||
| 22 | """ |
||
| 23 | super(ComputationalGraph, self).__init__(input_dim, input_tensor=input_tensor) |
||
| 24 | if model: |
||
| 25 | self.stack(model) |
||
| 26 | if output: |
||
| 27 | self.stack(output) |
||
| 28 | if cost: |
||
| 29 | self.stack(cost) |
||
| 30 | if blocks: |
||
| 31 | self.register(*blocks) |
||
| 32 | if input_vars: |
||
| 33 | self.input_variables = [t.tensor for t in input_vars] |
||
| 34 | if target_vars: |
||
| 35 | self.target_variables = [t.tensor for t in target_vars] |
||
| 36 | |||
| 44 | return self.test_output |