self.dtype don't exist for this op. dtype_%(var name)s don't exist in the c_support_code I think. So you need to access the dtype from the node. This can be done if you rename c_support_code() to 

c_support_code_apply(self, node):

then you can access

node.inputs[*].dtype