package caisar

  1. Overview
  2. Docs

Attributes

A named attribute containing either singular float, integer, string, graph, and tensor values, or repeated float, integer, string, graph, and tensor values. An AttributeProto MUST contain the name field, and *only one* of the following content fields, effectively enforcing a C/C++ union equivalent.

module AttributeType : sig ... end

Note: this enum is structurally identical to the OpSchema::AttrType enum defined in schema.h. If you rev one, you likely need to rev the other.

type t = {
  1. name : string option;
    (*

    The name field MUST be present for this version of the IR.

    namespace Attribute

    *)
  2. f : float option;
    (*

    Exactly ONE of the following fields must be present for this version of the IR

    float

    *)
  3. i : int64 option;
    (*

    int

    *)
  4. s : bytes option;
    (*

    UTF-8 string

    *)
  5. t : TensorProto.t option;
    (*

    tensor value

    *)
  6. g : GraphProto.t option;
    (*

    graph

    *)
  7. floats : float list;
    (*

    list of floats

    *)
  8. ints : int64 list;
    (*

    list of ints

    *)
  9. strings : bytes list;
    (*

    list of UTF-8 strings

    *)
  10. tensors : TensorProto.t list;
    (*

    list of tensors

    *)
  11. graphs : GraphProto.t list;
    (*

    list of graph

    *)
  12. doc_string : string option;
    (*

    A human-readable documentation for this attribute. Markdown is allowed.

    *)
  13. tp : TypeProto.t option;
    (*

    Do not use field below, it's deprecated. optional ValueProto v = 12; // value - subsumes everything but graph

    type proto

    *)
  14. type_protos : TypeProto.t list;
    (*

    list of type protos

    *)
  15. type' : AttributeType.t option;
    (*

    The type field MUST be present for this version of the IR. For 0.0.1 versions of the IR, this field was not defined, and implementations needed to use has_field heuristics to determine which value field was in use. For IR_VERSION 0.0.2 or later, this field MUST be set and match the f|i|s|t|... field in use. This change was made to accommodate proto3 implementations.

    discriminator that indicates which field below is in use

    *)
  16. ref_attr_name : string option;
    (*

    if ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. In this case, this AttributeProto does not contain data, and it's a reference of attribute in parent scope. NOTE: This should ONLY be used in function (sub-graph). It's invalid to be used in main graph.

    *)
  17. sparse_tensor : SparseTensorProto.t option;
    (*

    sparse tensor value

    *)
  18. sparse_tensors : SparseTensorProto.t list;
    (*

    list of sparse tensors

    *)
}
val make : ?name:string -> ?f:float -> ?i:int64 -> ?s:bytes -> ?t:TensorProto.t -> ?g:GraphProto.t -> ?floats:float list -> ?ints:int64 list -> ?strings:bytes list -> ?tensors:TensorProto.t list -> ?graphs:GraphProto.t list -> ?doc_string:string -> ?tp:TypeProto.t -> ?type_protos:TypeProto.t list -> ?type':AttributeType.t -> ?ref_attr_name:string -> ?sparse_tensor:SparseTensorProto.t -> ?sparse_tensors:SparseTensorProto.t list -> unit -> t

Helper function to generate a message using default values

Serialize the message to binary format

val from_proto : Ocaml_protoc_plugin.Reader.t -> (t, [> Ocaml_protoc_plugin.Result.error ]) Stdlib.result

Deserialize from binary format

Serialize to Json (compatible with Yojson.Basic.t)

val from_json : Ocaml_protoc_plugin.Json.t -> (t, [> Ocaml_protoc_plugin.Result.error ]) Stdlib.result

Deserialize from Json (compatible with Yojson.Basic.t)

val name : unit -> string

Fully qualified protobuf name of this message

OCaml

Innovation. Community. Security.