singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wangwei (JIRA)" <>
Subject [jira] [Created] (SINGA-179) Add shape check and type cast for math functions.
Date Tue, 24 May 2016 09:38:14 GMT
wangwei created SINGA-179:

             Summary: Add shape check and type cast for math functions.
                 Key: SINGA-179
             Project: Singa
          Issue Type: New Feature
            Reporter: wangwei

Some math functions require the operands to match certain shape and types.
For example, the matrix multiplication A*B =C, requires A's column size = B's row size. We
need to insert checks into either or tensor_math*.cc.
Some function template has an argument for scalar data types, e.g.,
template<typename DType>
Tensor Add(Tensor a, DType x);
For such functions, we need to cast the x into the same data type as a. 
The following function could added,

tempalte<typename S, typename D>
D CastType(S x) {
   return static_cast<D>(x);
for some special types, e.g., fp16, template specialization should be implemented.

This message was sent by Atlassian JIRA

View raw message