def get_ops(self): mul_dtypes = (self.data.dtype, FixedPoint(16, 15)) rshift_dtype = FixedPoint(self.data.dtype.bits + 16, self.data.dtype.frac_bits + 15) cmp_dtypes = (self.data.dtype) return { Ops.MUL(mul_dtypes): self.data.size, Ops.RSHIFT(rshift_dtype): self.data.size, Ops.CMP(cmp_dtypes): self.data.size }
def get_ops(self): num = 1 for i in range(len(self.data.shape)): num *= self.data.shape[i] add = num dtypes = (self.data.dtype, self.weights.dtype) return {Ops.ADD(dtypes): add}
def get_ops(self): num = 1 for i in range(len(self.data.shape)): if i != self.dim: num *= self.data.shape[i] add = num dtypes = (self.output_loss.dtype, self.data.dtype) return {Ops.ADD(dtypes): add}
def get_ops(self): num = 1 for i in range(len(self.data.shape) - 1): num *= self.data.shape[i] cout = self.output_loss[0].shape[-1] cin = self.data.shape[-1] mac = cin * \ cout * \ num dtypes = (self.output_loss[0].dtype, self.data.dtype, self.output_tensors.dtype) return {Ops.MAC(dtypes): mac}
def get_ops(self): num = 1 for i in range(len(self.data.shape) - 1): num *= self.data.shape[i] cout = self.output_loss[0].shape[-1] cin = self.data.shape[-1] mul = cin * \ cout * \ num add = num # return {Ops.MUL: mul, Ops.ADD: add} dtypes = (self.output_loss[0].dtype, self.data.dtype, self.output_tensors.dtype) return {Ops.MAC(dtypes): mul}
def get_ops(self): num = 1 for i in range(len(self.output_tensors.shape) - 3): num *= self.data.shape[i] cin = self.data.shape[-3] hin = self.data.shape[-2] win = self.data.shape[-1] hfil = self.pooling_kernel[-2] wfil = self.pooling_kernel[-1] CMP = hfil * wfil * \ hin * win * cin * \ num dtypes = (self.data.dtype) return {Ops.CMP(dtypes): CMP}
def get_ops(self): num = 1 for i in range(len(self.data.shape) - 3): num *= self.data.shape[i] cout = self.output_loss[0].shape[-3] cin = self.data.shape[-3] hin = self.data.shape[-2] win = self.data.shape[-1] hfil = self.weights.shape[-2] wfil = self.weights.shape[-1] mac = (wfil * hfil * cout * \ cin * hin * win * \ num)/self.group dtypes = (self.output_loss[0].dtype, self.weights.dtype, self.output_tensors.dtype) return {Ops.MAC(dtypes): mac}
def get_ops(self): num = 1 for i in range(len(self.data.shape) - 3): num *= self.data.shape[i] cout = self.output_loss[0].shape[-3] cin = self.data.shape[-3] hout = self.output_loss[0].shape[-2] wout = self.output_loss[0].shape[-1] hfil = self.weights.shape[-2] wfil = self.weights.shape[-1] mul = (hout * wout * \ cout * cin * hfil * wfil * \ num) / self.group add = (hout * wout * \ num) / self.group # return {Ops.MUL: mul, Ops.ADD: add} dtypes = (self.output_loss[0].dtype, self.data.dtype, self.output_tensors.dtype) return {Ops.MAC(dtypes): mul}
def get_ops(self): ops = self.data.size sub_dtypes = (self.data.dtype, self.mean.dtype) mul_dtypes = (self.data.dtype, self.scale.dtype) return {Ops.SUB(sub_dtypes): ops, Ops.MUL(sub_dtypes): ops}