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.6 kB

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

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