singa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wangwei (JIRA)" <j...@apache.org>
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
                 URL: https://issues.apache.org/jira/browse/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 Tensor.cc or tensor_math*.cc.
Some function template has an argument for scalar data types, e.g.,
{code}
template<typename DType>
Tensor Add(Tensor a, DType x);
{code}
For such functions, we need to cast the x into the same data type as a. 
The following function could added,

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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message