You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

tensor.proto 3.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. syntax = "proto3";
  2. package domi.tensorflow;
  3. option cc_enable_arenas = true;
  4. option java_outer_classname = "TensorProtos";
  5. option java_multiple_files = true;
  6. option java_package = "org.tensorflow.framework";
  7. import "resource_handle.proto";
  8. import "tensor_shape.proto";
  9. import "types.proto";
  10. // Protocol buffer representing a tensor.
  11. message TensorProto {
  12. DataType dtype = 1;
  13. // Shape of the tensor.
  14. TensorShapeProto tensor_shape = 2;
  15. // Only one of the representations below is set, one of "tensor_contents" and
  16. // the "xxx_val" attributes. We are not using oneof because as oneofs cannot
  17. // contain repeated fields it would require another extra set of messages.
  18. // Version number.
  19. //
  20. // In version 0, if the "repeated xxx" representations contain only one
  21. // element, that element is repeated to fill the shape. This makes it easy
  22. // to represent a constant Tensor with a single value.
  23. int32 version_number = 3;
  24. // Serialized raw tensor content from either Tensor::AsProtoTensorContent or
  25. // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation
  26. // can be used for all tensor types. The purpose of this representation is to
  27. // reduce serialization overhead during RPC call by avoiding serialization of
  28. // many repeated small items.
  29. bytes tensor_content = 4;
  30. // Type specific representations that make it easy to create tensor protos in
  31. // all languages. Only the representation corresponding to "dtype" can
  32. // be set. The values hold the flattened representation of the tensor in
  33. // row major order.
  34. // DT_HALF, DT_BFLOAT16. Note that since protobuf has no int16 type, we'll
  35. // have some pointless zero padding for each value here.
  36. repeated int32 half_val = 13 [packed = true];
  37. // DT_FLOAT.
  38. repeated float float_val = 5 [packed = true];
  39. // DT_DOUBLE.
  40. repeated double double_val = 6 [packed = true];
  41. // DT_INT32, DT_INT16, DT_INT8, DT_UINT8.
  42. repeated int32 int_val = 7 [packed = true];
  43. // DT_STRING
  44. repeated bytes string_val = 8;
  45. // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real
  46. // and imaginary parts of i-th single precision complex.
  47. repeated float scomplex_val = 9 [packed = true];
  48. // DT_INT64
  49. repeated int64 int64_val = 10 [packed = true];
  50. // DT_BOOL
  51. repeated bool bool_val = 11 [packed = true];
  52. // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real
  53. // and imaginary parts of i-th double precision complex.
  54. repeated double dcomplex_val = 12 [packed = true];
  55. // DT_RESOURCE
  56. repeated ResourceHandleProto resource_handle_val = 14;
  57. // DT_VARIANT
  58. repeated VariantTensorDataProto variant_val = 15;
  59. // DT_UINT32
  60. repeated uint32 uint32_val = 16 [packed = true];
  61. // DT_UINT64
  62. repeated uint64 uint64_val = 17 [packed = true];
  63. };
  64. // Protocol buffer representing the serialization format of DT_VARIANT tensors.
  65. message VariantTensorDataProto {
  66. // Name of the type of objects being serialized.
  67. string type_name = 1;
  68. // Portions of the object that are not Tensors.
  69. bytes metadata = 2;
  70. // Tensors contained within objects being serialized.
  71. repeated TensorProto tensors = 3;
  72. }

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示