Args: t (Tensor): input tensor x (float or Tensor): y[i] = t[i]^x if x is a float value; otherwise, y[i]= t[i]^x[i] if x is a tensor. out (None or Tensor): if None, a new Tensor would be constructed to store the result; otherwise, the result is pu
(t, x, out=None)
| 1066 | |
| 1067 | |
| 1068 | def pow(t, x, out=None): |
| 1069 | ''' |
| 1070 | Args: |
| 1071 | t (Tensor): input tensor |
| 1072 | x (float or Tensor): y[i] = t[i]^x if x is a float value; otherwise, |
| 1073 | y[i]= t[i]^x[i] if x is a tensor. |
| 1074 | out (None or Tensor): if None, a new Tensor would be constructed to |
| 1075 | store the result; otherwise, the result is put into out. |
| 1076 | |
| 1077 | Returns: |
| 1078 | the result tensor. |
| 1079 | ''' |
| 1080 | if out is None: |
| 1081 | if isinstance(x, Tensor): |
| 1082 | return _call_singa_func(singa.Pow, t.data, x.data) |
| 1083 | else: |
| 1084 | return _call_singa_func(singa.PowFloat, t.data, x) |
| 1085 | else: |
| 1086 | if isinstance(x, Tensor): |
| 1087 | singa.PowWithRet(t.data, x.data, out.data) |
| 1088 | else: |
| 1089 | singa.PowFloatWitRet(t.data, x, out.data) |
| 1090 | return out |
| 1091 | |
| 1092 | |
| 1093 | def average(t, axis=None): |
no test coverage detected