Args: t (Tensor): input Tensor axis (int, optional): if None, average all elements; otherwise average along the given dimension. 0 for averaging each column; 1 for averaging each row. Returns: a float value if axis is None; otherwise, a new T
(t, axis=None)
| 1091 | |
| 1092 | |
| 1093 | def average(t, axis=None): |
| 1094 | ''' |
| 1095 | Args: |
| 1096 | t (Tensor): input Tensor |
| 1097 | axis (int, optional): if None, average all elements; otherwise average |
| 1098 | along the given dimension. 0 for averaging each column; 1 for |
| 1099 | averaging each row. |
| 1100 | |
| 1101 | Returns: |
| 1102 | a float value if axis is None; otherwise, a new Tensor for the result. |
| 1103 | ''' |
| 1104 | if t.ndim() > 1: |
| 1105 | return _call_singa_func(singa.Average, t.data, axis) |
| 1106 | else: |
| 1107 | return singa.SumAsFloat(t.data) / t.size() |
| 1108 | |
| 1109 | |
| 1110 | def softmax(t, out=None): |
nothing calls this directly
no test coverage detected