def bind_flex_scales(self): scaleAB = self.flex_entry_A.scale * self.flex_entry_B.scale scaleC = self.flex_entry_C.scale alpha = self.alpha * scaleAB beta = self.beta * scaleC # TODO: hardcoding these sucks self.params[6] = alpha self.params[7] = beta self.params[20] = 1. / scaleC FlexPtrDescription.bind_ptr(self.params)
def bind_flex_scales(self): scaleAB = self.flex_entry_I.scale * self.flex_entry_F.scale scaleC = self.flex_entry_O.scale alpha = self.alpha * scaleAB beta = self.beta * scaleC for kernel in self.kernels: kernel[8] = alpha kernel[9] = beta kernel[-1] = 1. / scaleC for kernel in self.kernels: FlexPtrDescription.bind_ptr(kernel)
def bind_flex_scales(self): scaleAB = self.flex_entry_E.scale * self.flex_entry_F.scale scaleC = self.flex_entry_O.scale alpha = self.alpha * scaleAB beta = self.beta * scaleC for kernel in self.kernels[1:1 + len(self.bprop_kernels)]: kernel[8] = alpha kernel[9] = beta kernel[-1] = 1. / scaleC if self.convert_out: self.kernels[-1][-2] = 1. / scaleC for kernel in self.kernels: FlexPtrDescription.bind_ptr(kernel)
def _ew_bind_flex_scales(kernel): for index, flex_scale_desc in kernel.flex_scale_info: scale = flex_scale_desc.flex_entry.scale scale = 1.0 / scale if flex_scale_desc.is_output else scale kernel.params[index] = scale FlexPtrDescription.bind_ptr(kernel.params)
def bind_flex_scales(self): for k in self.kernels: kernel, params = k FlexPtrDescription.bind_ptr(params)
def bind_flex_scales(self): self.transformer.get_op_tensor(self.op).flex_entry.allocate() FlexPtrDescription.bind_ptr(self.params)