pub fn tensor_of_type(
    name: &str,
    dimensions: &[i64],
    data_type: TensorProto_DataType,
) -> onnx::ValueInfoProto {
    let mut dim_value = vec![];
    for dimension in dimensions {
        let mut dim_channel = onnx::TensorShapeProto_Dimension::new();
        dim_channel.set_dim_value(*dimension);
        dim_value.push(dim_channel);
    }

    let mut shape_tensor_proto = onnx::TensorShapeProto::new();
    shape_tensor_proto.set_dim(protobuf::RepeatedField::from(dim_value));

    let mut type_proto_tensor = onnx::TypeProto_Tensor::new();
    type_proto_tensor.set_elem_type(data_type.value());
    type_proto_tensor.set_shape(shape_tensor_proto);

    let mut type_proto = onnx::TypeProto::new();
    type_proto.set_tensor_type(type_proto_tensor);

    let mut tensor = onnx::ValueInfoProto::new();
    tensor.set_name(name.to_string());
    tensor.set_field_type(type_proto);

    tensor
}
/// Shorthand method to define an ONNX tensor with the specified name, shape and data type
Shorthand method to define an ONNX tensor with the specified name, shape and data type
Shorthand method to define an ONNX tensor with the specified name shape and data type
pub fn tensor_of_type(
    name: &str,
    dimensions: &[i64],
    data_type: TensorProto_DataType,
) -> onnx::ValueInfoProto {
    let mut dim_value = vec![];
    for dimension in dimensions {
        let mut dim_channel = onnx::TensorShapeProto_Dimension::new();
        dim_channel.set_dim_value(*dimension);
        dim_value.push(dim_channel);
    }
    let mut shape_tensor_proto = onnx::TensorShapeProto::new();
    shape_tensor_proto.set_dim(protobuf::RepeatedField::from(dim_value));
    let mut type_proto_tensor = onnx::TypeProto_Tensor::new();
    type_proto_tensor.set_elem_type(data_type.value());
    type_proto_tensor.set_shape(shape_tensor_proto);
    let mut type_proto = onnx::TypeProto::new();
    type_proto.set_tensor_type(type_proto_tensor);
    let mut tensor = onnx::ValueInfoProto::new();
    tensor.set_name(name.to_string());
    tensor.set_field_type(type_proto);
    tensor
}
pub fn tensor_of_type ( name : & str , dimensions : & [ i64 ] , data_type : TensorProto_DataType , ) -> onnx :: ValueInfoProto { let mut dim_value = vec ! [ ] ; for dimension in dimensions { let mut dim_channel = onnx :: TensorShapeProto_Dimension :: new ( ) ; dim_channel . set_dim_value ( * dimension ) ; dim_value . push ( dim_channel ) ; } let mut shape_tensor_proto = onnx :: TensorShapeProto :: new ( ) ; shape_tensor_proto . set_dim ( protobuf :: RepeatedField :: from ( dim_value ) ) ; let mut type_proto_tensor = onnx :: TypeProto_Tensor :: new ( ) ; type_proto_tensor . set_elem_type ( data_type . value ( ) ) ; type_proto_tensor . set_shape ( shape_tensor_proto ) ; let mut type_proto = onnx :: TypeProto :: new ( ) ; type_proto . set_tensor_type ( type_proto_tensor ) ; let mut tensor = onnx :: ValueInfoProto :: new ( ) ; tensor . set_name ( name . to_string ( ) ) ; tensor . set_field_type ( type_proto ) ; tensor }
Shorthand method to define an ONNX tensor with the specified name, shape and data type
Shorthand method to define an ONNX tensor with the specified name shape and data type
name
&str
dimensions
&[i64]
data_type
TensorProto_DataType
name
&str
dimensions
&[i64]
data_type
TensorProto_DataType