* @param[in] x Tensor
* @retVal Tensor
*/
-Tensor softmaxPrime(Tensor x);
+Tensor softmaxPrime(Tensor const &x);
/**
* @brief Calculate softmax for Tensor Type
* @param[in] t Tensor
* @retval Tensor
*/
-Tensor softmax(Tensor t);
+Tensor softmax(Tensor const &t);
/**
* @brief random function
unsigned int getSeed() { return 0; }
-Tensor softmaxPrime(Tensor x) {
+Tensor softmaxPrime(Tensor const &x) {
/** @todo Fix this to use derivative */
int batch = x.getBatch();
int channel = x.getChannel();
Tensor PI = Tensor(x.getDim());
- float *xp = x.getData();
+ const float *xp = x.getData();
float *pp = PI.getData();
for (int k = 0; k < batch; ++k) {
return PI;
}
-Tensor softmax(Tensor t) {
+Tensor softmax(Tensor const &t) {
/**
* shiftx_logit = logit - max_batch(logit)
* softmax = exp(shiftx_logit) / (sum(exp(shiftx_logit)))
int width = t.getWidth();
float *dp;
float *rp;
- float *tp;
+ const float *tp;
Tensor result(t.getDim());
Tensor divisor(t.getDim());