MCPcopy Create free account
hub / github.com/apache/singa / axis_helper

Function axis_helper

test/python/test_operation.py:43–58  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

41
42
43def 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
61def prepare_inputs_targets_for_rnn_test(dev):

Callers 7

_add_broadcast_helperMethod · 0.70
_sub_broadcast_helperMethod · 0.70
_mul_broadcast_helperMethod · 0.70
_div_broadcast_helperMethod · 0.70
_pow_broadcast_helperMethod · 0.70
_gemm_helperMethod · 0.70

Calls 2

appendMethod · 0.80
tupleFunction · 0.50

Tested by

no test coverage detected