Check for broadcasting compatibility in Tensorflow - C++ API -
i implementing element-wise operations in tensorflow. many tensorflow operations, e.g. add, support broadcasting (from numpy). broadcasting possible if following rule respected:
when operating on 2 tensors, shapes should compared element-wise. procedure starts trailing dimensions, , works way forward. 2 dimensions compatible when equal, or 1 of them 1. if these conditions not met, exception thrown, indicating tensors have incompatible shapes. size of resulting tensor maximum size along each dimension of input arrays.
does tensorflow c++ api provide method comparing compatibility of 2 tensors? or, fastest way that?
all element-wise binary operations' kernel implementations in tensorflow derive binaryopshared
class, compatibility checking via helper class binaryopstate
. perhaps, can derive kernel class binaryopshared
, compatibility checking free.
Comments
Post a Comment