def dump_complex_conv2d_to_file(self, node, f):
        assert(node.op == 'Conv2D')
        self.layer_number = self.layer_number + 1
        self.converted_nodes.add(node.name)

        scope_name = TFConverter.get_scope_name(node.name)
        #knode for kernel, bnode for bias, dnode for dilation, anode for activation
        knode, bnode, dnode, anode = self.get_conv2d_params(scope_name)

        if dnode is not None:
            dilation = struct.unpack('i', dnode.attr['value'].tensor.tensor_content[0:4])[0]
        else:
            dilation = 1

        if anode is not None:
            activation = anode.op
        else:
            activation = 'None'

        padding = node.attr['padding'].s.decode("utf-8")
        # conv2d with dilation > 1 generates tens of nodes, not easy to parse them, so use this tricky method.
        if dilation > 1 and scope_name + '/stack' in self.name_node_dict:
            if self.name_node_dict[scope_name + '/stack'].op == "Const":
                padding = 'SAME'
        padding = self.conv_paddings[padding]

        ktensor = knode.attr['value'].tensor
        filter_height = ktensor.tensor_shape.dim[0].size
        filter_width = ktensor.tensor_shape.dim[1].size
        in_channels = ktensor.tensor_shape.dim[2].size
        out_channels = ktensor.tensor_shape.dim[3].size
        kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32)
        kernel = kernel.reshape(filter_height, filter_width, in_channels, out_channels)
        kernel = np.transpose(kernel, [3, 0, 1, 2])

        has_bias = 1
        np.array([self.op2code[node.op], dilation, padding, self.conv_activations[activation], in_channels, out_channels, filter_height, has_bias], dtype=np.uint32).tofile(f)
        kernel.tofile(f)

        btensor = bnode.attr['value'].tensor
        if btensor.tensor_shape.dim[0].size == 1:
            bias = struct.pack("f", btensor.float_val[0])
        else:
            bias = btensor.tensor_content
        f.write(bias)

        input_name = self.conv2d_scopename_inputname_dict[scope_name]
        input_operand_index = self.add_operand(input_name, Operand.IOTYPE_INPUT)

        if anode is not None:
            output_operand_index = self.add_operand(anode.name, Operand.IOTYPE_OUTPUT)
        else:
            output_operand_index = self.add_operand(self.edges[bnode.name][0].name, Operand.IOTYPE_OUTPUT)
        np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)