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

Function pow

examples/model_selection/Trails/singa_pkg_code/tensor.py:1068–1090  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1066
1067
1068def 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
1093def average(t, axis=None):

Callers 1

TrainFunction · 0.50

Calls 1

_call_singa_funcFunction · 0.70

Tested by

no test coverage detected