Skip to content

Syntax error in NDArray #34

@Iainmon

Description

@Iainmon

ChAI/lib/NDArray.chpl

Lines 749 to 772 in a447591

inline proc hardsigmoid() {
const ref thisData = data;
const dom = this.domain;
var rl = new ndarray(dom, eltType);
ref rld = rl.data;
forall i in dom.every() {
const x = thisData[i];
rld[i] = max(0, min(1, x/6.0 + 0.5));
}
return rl;
inline proc hardshrink(l: eltType=0.5) {
const ref thisData = data;
const dom = this.domain;
var rl = new ndarray(dom, eltType);
ref rld = rl.data;
forall i in dom.every() {
const x = thisData[i];
const float_max = Types.max(eltType);
const xmap0 = ceil(1.0 / float_max * (x - l) * (x + l)); // 0 if x in [-l, l], 1 otherwise
rld[i] = x * xmap0;
}
return rl;
}

What is hardsigmoid? @BrandynTucknott

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions