check which axes the x has been broadcasted Args: y_shape: the shape of result x_shape: the shape of x Return: a tuple refering the axes
(y_shape, x_shape)
| 41 | |
| 42 | |
| 43 | def axis_helper(y_shape, x_shape): |
| 44 | """ |
| 45 | check which axes the x has been broadcasted |
| 46 | Args: |
| 47 | y_shape: the shape of result |
| 48 | x_shape: the shape of x |
| 49 | Return: |
| 50 | a tuple refering the axes |
| 51 | """ |
| 52 | res = [] |
| 53 | j = len(x_shape) - 1 |
| 54 | for i in range(len(y_shape) - 1, -1, -1): |
| 55 | if j < 0 or x_shape[j] != y_shape[i]: |
| 56 | res.append(i) |
| 57 | j -= 1 |
| 58 | return tuple(res[::-1]) |
| 59 | |
| 60 | |
| 61 | def prepare_inputs_targets_for_rnn_test(dev): |
no test coverage detected