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)
| 1126 | |
| 1127 | |
| 1128 | def average(t, axis=None): |
| 1129 | ''' |
| 1130 | Args: |
| 1131 | t (Tensor): input Tensor |
| 1132 | axis (int, optional): if None, average all elements; otherwise average |
| 1133 | along the given dimension. 0 for averaging each column; 1 for |
| 1134 | averaging each row. |
| 1135 | |
| 1136 | Returns: |
| 1137 | a float value if axis is None; otherwise, a new Tensor for the result. |
| 1138 | ''' |
| 1139 | if t.ndim() > 1: |
| 1140 | return _call_singa_func(singa.Average, t.data, axis) |
| 1141 | else: |
| 1142 | return singa.SumAsFloat(t.data) / t.size() |
| 1143 | |
| 1144 | |
| 1145 | def softmax(t, out=None): |
nothing calls this directly
no test coverage detected