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

Method l1

src/core/tensor/tensor.cc:815–827  ·  view source on GitHub ↗

=============Element-wise operations====================================

Source from the content-addressed store, hash-verified

813
814// =============Element-wise operations====================================
815float Tensor::l1() const {
816 float nrm = 0.0f;
817 TYPE_LANG_SWITCH(data_type_, DType, device_->lang(), Lang, {
818 device_->Exec(
819 [&nrm, this](Context *ctx) {
820 DType ret = DType(0);
821 Asum<DType, Lang>(*this, &ret, ctx);
822 nrm = TypeCast<DType, float>(ret);
823 },
824 {this->block()}, {}, "l1");
825 });
826 return nrm / Size();
827}
828
829// DEPRECATED use l1()
830float Tensor::L1() const { return l1(); }

Callers 2

forwardMethod · 0.45
forwardMethod · 0.45

Calls 3

blockMethod · 0.95
langMethod · 0.80
ExecMethod · 0.80

Tested by 2

forwardMethod · 0.36
forwardMethod · 0.36