Ejemplo n.º 1
0
 def generate_onnx_graph(dim, nbnode, input_name='X1'):
     i1 = input_name
     scale = list(np.ones((1, dim)).ravel())
     for i in range(nbnode - 1):
         i2 = list(
             map(float,
                 np.ones((1, dim)).astype(np.float32).ravel()))
         node = OnnxScaler(i1, offset=i2, scale=scale)
         i1 = node
     i2 = list(map(float, np.ones((1, dim)).astype(np.float32).ravel()))
     node = OnnxScaler(i1, offset=i2, scale=scale, output_names=['Y'])
     onx = node.to_onnx([(input_name, FloatTensorType((None, dim)))],
                        outputs=[('Y', FloatTensorType((None, dim)))])
     return onx
 def generate_onnx_graph(dim, nbnode, input_name='X1'):
     matrices = []
     scale = list(numpy.ones((1, dim)).ravel())
     i1 = input_name
     for i in range(nbnode - 1):
         i2 = list(rand(1, dim).ravel())
         matrices.append(i2)
         node = OnnxScaler(i1, offset=i2, scale=scale)
         i1 = node
     i2 = list(rand(1, dim).ravel())
     matrices.append(i2)
     node = OnnxScaler(i1, offset=i2, scale=scale, output_names=['Y'])
     onx = node.to_onnx([(input_name, FloatTensorType((1, dim)))],
                        outputs=[('Y', FloatTensorType((1, dim)))])
     return onx, matrices
def generate_onnx_graph(dim, nbnode, input_name='X1'):
    """Generates a series of consecutive scalers."""

    matrices = []
    scale = list(numpy.ones((1, dim)).ravel())
    i1 = input_name
    for i in range(nbnode - 1):
        i2 = list(-random_binary_classification(1, dim)[0].ravel())
        matrices.append(i2)
        node = OnnxScaler(i1, offset=i2, scale=scale)
        i1 = node
    i2 = list(-random_binary_classification(1, dim)[0].ravel())
    matrices.append(i2)
    node = OnnxScaler(i1, offset=i2, scale=scale, output_names=['Y'])
    onx = node.to_onnx([(input_name, FloatTensorType((None, dim)))],
                       outputs=[('Y', FloatTensorType((None, dim)))])
    onx.ir_version = get_ir_version(__max_supported_opset__)
    return onx, matrices