浏览代码
[WIP] ISensor interface and use for visual observations (#2731)
[WIP] ISensor interface and use for visual observations (#2731)
* ISensor and SensorBase * camera and rendertex first pass * use isensors for visual obs * Update gridworld with CameraSensors * compressed obs for reals * Remove AgentInfo.visualObservations * better separation of train and inference sensor calls * compressed obs proto - need CI to generate code * int32 * get proto name right * run protoc locally for new fiels * apply generated proto patch (pyi files were weird) * don't repeat bytes * hook up compressedobs * dont send BrainParameters until there's an AgentInfo * python BrainParameters now needs an AgentInfo to create * remove last (I hope) dependency on camerares * remove CameraResolutions and AgentInfo.visual_observations * update mypy-protobuf version * cleanup todos * python cleanup * more unit test fixes * more unit test fix * camera sensors for VisualFood collector, record demo * SensorCompon.../develop-gpu-test
GitHub
5 年前
当前提交
0892ef2c
共有 80 个文件被更改,包括 1919 次插入 和 2232 次删除
-
51UnitySDK/Assets/ML-Agents/Editor/AgentEditor.cs
-
113UnitySDK/Assets/ML-Agents/Editor/BrainParametersDrawer.cs
-
30UnitySDK/Assets/ML-Agents/Editor/DemonstrationDrawer.cs
-
2UnitySDK/Assets/ML-Agents/Editor/Tests/DemonstrationTests.cs
-
48UnitySDK/Assets/ML-Agents/Editor/Tests/MLAgentsEditModeTest.cs
-
5UnitySDK/Assets/ML-Agents/Examples/3DBall/Scripts/Ball3DDecision.cs
-
7UnitySDK/Assets/ML-Agents/Examples/Basic/Scripts/BasicDecision.cs
-
64UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Prefabs/VisualFoodCollectorArea.prefab
-
43UnitySDK/Assets/ML-Agents/Examples/FoodCollector/Scenes/VisualFoodCollector.unity
-
16UnitySDK/Assets/ML-Agents/Examples/GridWorld/Prefabs/Area.prefab
-
24UnitySDK/Assets/ML-Agents/Examples/GridWorld/Scenes/GridWorld.unity
-
20UnitySDK/Assets/ML-Agents/Examples/Hallway/Prefabs/VisualSymbolFinderArea.prefab
-
83UnitySDK/Assets/ML-Agents/Examples/Hallway/Scenes/VisualHallway.unity
-
20UnitySDK/Assets/ML-Agents/Examples/PushBlock/Prefabs/PushBlockVisualArea.prefab
-
63UnitySDK/Assets/ML-Agents/Examples/PushBlock/Scenes/VisualPushBlock.unity
-
20UnitySDK/Assets/ML-Agents/Examples/Pyramids/Prefabs/VisualAreaPyramids.prefab
-
83UnitySDK/Assets/ML-Agents/Examples/Pyramids/Scenes/VisualPyramids.unity
-
7UnitySDK/Assets/ML-Agents/Examples/Reacher/Scripts/ReacherDecision.cs
-
7UnitySDK/Assets/ML-Agents/Examples/SharedAssets/Scripts/RandomDecision.cs
-
7UnitySDK/Assets/ML-Agents/Examples/Template/Scripts/TemplateDecision.cs
-
196UnitySDK/Assets/ML-Agents/Scripts/Agent.cs
-
43UnitySDK/Assets/ML-Agents/Scripts/Brain.cs
-
26UnitySDK/Assets/ML-Agents/Scripts/BrainParameters.cs
-
12UnitySDK/Assets/ML-Agents/Scripts/Decision.cs
-
69UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/AgentInfo.cs
-
44UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/BrainParameters.cs
-
9UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/SpaceType.cs
-
2UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/CompressedObservation.cs.meta
-
56UnitySDK/Assets/ML-Agents/Scripts/Grpc/GrpcExtensions.cs
-
80UnitySDK/Assets/ML-Agents/Scripts/Grpc/RpcCommunicator.cs
-
4UnitySDK/Assets/ML-Agents/Scripts/HeuristicBrain.cs
-
56UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/BarracudaModelParamLoader.cs
-
15UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/GeneratorImpl.cs
-
12UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/ModelRunner.cs
-
23UnitySDK/Assets/ML-Agents/Scripts/InferenceBrain/TensorGenerator.cs
-
67UnitySDK/Assets/ML-Agents/Scripts/Utilities.cs
-
24ml-agents-envs/mlagents/envs/brain.py
-
44ml-agents-envs/mlagents/envs/communicator_objects/agent_info_pb2.py
-
15ml-agents-envs/mlagents/envs/communicator_objects/agent_info_pb2.pyi
-
25ml-agents-envs/mlagents/envs/communicator_objects/brain_parameters_pb2.py
-
13ml-agents-envs/mlagents/envs/communicator_objects/brain_parameters_pb2.pyi
-
10ml-agents-envs/mlagents/envs/communicator_objects/space_type_pb2.py
-
38ml-agents-envs/mlagents/envs/environment.py
-
28ml-agents-envs/mlagents/envs/mock_communicator.py
-
7ml-agents/mlagents/trainers/demo_loader.py
-
27ml-agents/mlagents/trainers/tests/mock_brain.py
-
46ml-agents/mlagents/trainers/tests/test_bc.py
-
73ml-agents/mlagents/trainers/tests/test_ppo.py
-
75ml-agents/mlagents/trainers/tests/test_sac.py
-
1001ml-agents/mlagents/trainers/tests/testdcvis.demo
-
4protobuf-definitions/proto/mlagents/envs/communicator_objects/agent_info.proto
-
3protobuf-definitions/proto/mlagents/envs/communicator_objects/brain_parameters.proto
-
2protobuf-definitions/proto/mlagents/envs/communicator_objects/space_type.proto
-
234UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/CompressedObservation.cs
-
8UnitySDK/Assets/ML-Agents/Scripts/Sensor.meta
-
113ml-agents-envs/mlagents/envs/communicator_objects/compressed_observation_pb2.py
-
72ml-agents-envs/mlagents/envs/communicator_objects/compressed_observation_pb2.pyi
-
15protobuf-definitions/proto/mlagents/envs/communicator_objects/compressed_observation.proto
-
101UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensor.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensor.cs.meta
-
19UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensorComponent.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/CameraSensorComponent.cs.meta
-
25UnitySDK/Assets/ML-Agents/Scripts/Sensor/CompressedObservation.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/CompressedObservation.cs.meta
-
54UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/ISensor.cs.meta
-
97UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensor.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensor.cs.meta
-
19UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensorComponent.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/RenderTextureSensorComponent.cs.meta
-
54UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorBase.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorBase.cs.meta
-
18UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorComponent.cs
-
11UnitySDK/Assets/ML-Agents/Scripts/Sensor/SensorComponent.cs.meta
-
231UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/Resolution.cs
-
85ml-agents-envs/mlagents/envs/communicator_objects/resolution_pb2.py
-
45ml-agents-envs/mlagents/envs/communicator_objects/resolution_pb2.pyi
-
11protobuf-definitions/proto/mlagents/envs/communicator_objects/resolution.proto
-
0/UnitySDK/Assets/ML-Agents/Scripts/Grpc/CommunicatorObjects/CompressedObservation.cs.meta
1001
ml-agents/mlagents/trainers/tests/testdcvis.demo
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
// <auto-generated>
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|||
// source: mlagents/envs/communicator_objects/compressed_observation.proto
|
|||
// </auto-generated>
|
|||
#pragma warning disable 1591, 0612, 3021
|
|||
#region Designer generated code
|
|||
|
|||
using pb = global::Google.Protobuf; |
|||
using pbc = global::Google.Protobuf.Collections; |
|||
using pbr = global::Google.Protobuf.Reflection; |
|||
using scg = global::System.Collections.Generic; |
|||
namespace MLAgents.CommunicatorObjects { |
|||
|
|||
/// <summary>Holder for reflection information generated from mlagents/envs/communicator_objects/compressed_observation.proto</summary>
|
|||
public static partial class CompressedObservationReflection { |
|||
|
|||
#region Descriptor
|
|||
/// <summary>File descriptor for mlagents/envs/communicator_objects/compressed_observation.proto</summary>
|
|||
public static pbr::FileDescriptor Descriptor { |
|||
get { return descriptor; } |
|||
} |
|||
private static pbr::FileDescriptor descriptor; |
|||
|
|||
static CompressedObservationReflection() { |
|||
byte[] descriptorData = global::System.Convert.FromBase64String( |
|||
string.Concat( |
|||
"Cj9tbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL2NvbXByZXNz", |
|||
"ZWRfb2JzZXJ2YXRpb24ucHJvdG8SFGNvbW11bmljYXRvcl9vYmplY3RzIn8K", |
|||
"GkNvbXByZXNzZWRPYnNlcnZhdGlvblByb3RvEg0KBXNoYXBlGAEgAygFEkQK", |
|||
"EGNvbXByZXNzaW9uX3R5cGUYAiABKA4yKi5jb21tdW5pY2F0b3Jfb2JqZWN0", |
|||
"cy5Db21wcmVzc2lvblR5cGVQcm90bxIMCgRkYXRhGAMgASgMKikKFENvbXBy", |
|||
"ZXNzaW9uVHlwZVByb3RvEggKBE5PTkUQABIHCgNQTkcQAUIfqgIcTUxBZ2Vu", |
|||
"dHMuQ29tbXVuaWNhdG9yT2JqZWN0c2IGcHJvdG8z")); |
|||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
|||
new pbr::FileDescriptor[] { }, |
|||
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::MLAgents.CommunicatorObjects.CompressionTypeProto), }, new pbr::GeneratedClrTypeInfo[] { |
|||
new pbr::GeneratedClrTypeInfo(typeof(global::MLAgents.CommunicatorObjects.CompressedObservationProto), global::MLAgents.CommunicatorObjects.CompressedObservationProto.Parser, new[]{ "Shape", "CompressionType", "Data" }, null, null, null) |
|||
})); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
#region Enums
|
|||
public enum CompressionTypeProto { |
|||
[pbr::OriginalName("NONE")] None = 0, |
|||
[pbr::OriginalName("PNG")] Png = 1, |
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
#region Messages
|
|||
public sealed partial class CompressedObservationProto : pb::IMessage<CompressedObservationProto> { |
|||
private static readonly pb::MessageParser<CompressedObservationProto> _parser = new pb::MessageParser<CompressedObservationProto>(() => new CompressedObservationProto()); |
|||
private pb::UnknownFieldSet _unknownFields; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pb::MessageParser<CompressedObservationProto> Parser { get { return _parser; } } |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pbr::MessageDescriptor Descriptor { |
|||
get { return global::MLAgents.CommunicatorObjects.CompressedObservationReflection.Descriptor.MessageTypes[0]; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
|||
get { return Descriptor; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public CompressedObservationProto() { |
|||
OnConstruction(); |
|||
} |
|||
|
|||
partial void OnConstruction(); |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public CompressedObservationProto(CompressedObservationProto other) : this() { |
|||
shape_ = other.shape_.Clone(); |
|||
compressionType_ = other.compressionType_; |
|||
data_ = other.data_; |
|||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public CompressedObservationProto Clone() { |
|||
return new CompressedObservationProto(this); |
|||
} |
|||
|
|||
/// <summary>Field number for the "shape" field.</summary>
|
|||
public const int ShapeFieldNumber = 1; |
|||
private static readonly pb::FieldCodec<int> _repeated_shape_codec |
|||
= pb::FieldCodec.ForInt32(10); |
|||
private readonly pbc::RepeatedField<int> shape_ = new pbc::RepeatedField<int>(); |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public pbc::RepeatedField<int> Shape { |
|||
get { return shape_; } |
|||
} |
|||
|
|||
/// <summary>Field number for the "compression_type" field.</summary>
|
|||
public const int CompressionTypeFieldNumber = 2; |
|||
private global::MLAgents.CommunicatorObjects.CompressionTypeProto compressionType_ = 0; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public global::MLAgents.CommunicatorObjects.CompressionTypeProto CompressionType { |
|||
get { return compressionType_; } |
|||
set { |
|||
compressionType_ = value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>Field number for the "data" field.</summary>
|
|||
public const int DataFieldNumber = 3; |
|||
private pb::ByteString data_ = pb::ByteString.Empty; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public pb::ByteString Data { |
|||
get { return data_; } |
|||
set { |
|||
data_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override bool Equals(object other) { |
|||
return Equals(other as CompressedObservationProto); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool Equals(CompressedObservationProto other) { |
|||
if (ReferenceEquals(other, null)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(other, this)) { |
|||
return true; |
|||
} |
|||
if(!shape_.Equals(other.shape_)) return false; |
|||
if (CompressionType != other.CompressionType) return false; |
|||
if (Data != other.Data) return false; |
|||
return Equals(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override int GetHashCode() { |
|||
int hash = 1; |
|||
hash ^= shape_.GetHashCode(); |
|||
if (CompressionType != 0) hash ^= CompressionType.GetHashCode(); |
|||
if (Data.Length != 0) hash ^= Data.GetHashCode(); |
|||
if (_unknownFields != null) { |
|||
hash ^= _unknownFields.GetHashCode(); |
|||
} |
|||
return hash; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override string ToString() { |
|||
return pb::JsonFormatter.ToDiagnosticString(this); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void WriteTo(pb::CodedOutputStream output) { |
|||
shape_.WriteTo(output, _repeated_shape_codec); |
|||
if (CompressionType != 0) { |
|||
output.WriteRawTag(16); |
|||
output.WriteEnum((int) CompressionType); |
|||
} |
|||
if (Data.Length != 0) { |
|||
output.WriteRawTag(26); |
|||
output.WriteBytes(Data); |
|||
} |
|||
if (_unknownFields != null) { |
|||
_unknownFields.WriteTo(output); |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int CalculateSize() { |
|||
int size = 0; |
|||
size += shape_.CalculateSize(_repeated_shape_codec); |
|||
if (CompressionType != 0) { |
|||
size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) CompressionType); |
|||
} |
|||
if (Data.Length != 0) { |
|||
size += 1 + pb::CodedOutputStream.ComputeBytesSize(Data); |
|||
} |
|||
if (_unknownFields != null) { |
|||
size += _unknownFields.CalculateSize(); |
|||
} |
|||
return size; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(CompressedObservationProto other) { |
|||
if (other == null) { |
|||
return; |
|||
} |
|||
shape_.Add(other.shape_); |
|||
if (other.CompressionType != 0) { |
|||
CompressionType = other.CompressionType; |
|||
} |
|||
if (other.Data.Length != 0) { |
|||
Data = other.Data; |
|||
} |
|||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(pb::CodedInputStream input) { |
|||
uint tag; |
|||
while ((tag = input.ReadTag()) != 0) { |
|||
switch(tag) { |
|||
default: |
|||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); |
|||
break; |
|||
case 10: |
|||
case 8: { |
|||
shape_.AddEntriesFrom(input, _repeated_shape_codec); |
|||
break; |
|||
} |
|||
case 16: { |
|||
compressionType_ = (global::MLAgents.CommunicatorObjects.CompressionTypeProto) input.ReadEnum(); |
|||
break; |
|||
} |
|||
case 26: { |
|||
Data = input.ReadBytes(); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
} |
|||
|
|||
#endregion Designer generated code
|
|
|||
fileFormatVersion: 2 |
|||
guid: 96db1714def024608a0ff58ed9eae82d |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT! |
|||
# source: mlagents/envs/communicator_objects/compressed_observation.proto |
|||
|
|||
import sys |
|||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
|||
from google.protobuf.internal import enum_type_wrapper |
|||
from google.protobuf import descriptor as _descriptor |
|||
from google.protobuf import message as _message |
|||
from google.protobuf import reflection as _reflection |
|||
from google.protobuf import symbol_database as _symbol_database |
|||
from google.protobuf import descriptor_pb2 |
|||
# @@protoc_insertion_point(imports) |
|||
|
|||
_sym_db = _symbol_database.Default() |
|||
|
|||
|
|||
|
|||
|
|||
DESCRIPTOR = _descriptor.FileDescriptor( |
|||
name='mlagents/envs/communicator_objects/compressed_observation.proto', |
|||
package='communicator_objects', |
|||
syntax='proto3', |
|||
serialized_pb=_b('\n?mlagents/envs/communicator_objects/compressed_observation.proto\x12\x14\x63ommunicator_objects\"\x7f\n\x1a\x43ompressedObservationProto\x12\r\n\x05shape\x18\x01 \x03(\x05\x12\x44\n\x10\x63ompression_type\x18\x02 \x01(\x0e\x32*.communicator_objects.CompressionTypeProto\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c*)\n\x14\x43ompressionTypeProto\x12\x08\n\x04NONE\x10\x00\x12\x07\n\x03PNG\x10\x01\x42\x1f\xaa\x02\x1cMLAgents.CommunicatorObjectsb\x06proto3') |
|||
) |
|||
|
|||
_COMPRESSIONTYPEPROTO = _descriptor.EnumDescriptor( |
|||
name='CompressionTypeProto', |
|||
full_name='communicator_objects.CompressionTypeProto', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
values=[ |
|||
_descriptor.EnumValueDescriptor( |
|||
name='NONE', index=0, number=0, |
|||
options=None, |
|||
type=None), |
|||
_descriptor.EnumValueDescriptor( |
|||
name='PNG', index=1, number=1, |
|||
options=None, |
|||
type=None), |
|||
], |
|||
containing_type=None, |
|||
options=None, |
|||
serialized_start=218, |
|||
serialized_end=259, |
|||
) |
|||
_sym_db.RegisterEnumDescriptor(_COMPRESSIONTYPEPROTO) |
|||
|
|||
CompressionTypeProto = enum_type_wrapper.EnumTypeWrapper(_COMPRESSIONTYPEPROTO) |
|||
NONE = 0 |
|||
PNG = 1 |
|||
|
|||
|
|||
|
|||
_COMPRESSEDOBSERVATIONPROTO = _descriptor.Descriptor( |
|||
name='CompressedObservationProto', |
|||
full_name='communicator_objects.CompressedObservationProto', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
containing_type=None, |
|||
fields=[ |
|||
_descriptor.FieldDescriptor( |
|||
name='shape', full_name='communicator_objects.CompressedObservationProto.shape', index=0, |
|||
number=1, type=5, cpp_type=1, label=3, |
|||
has_default_value=False, default_value=[], |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='compression_type', full_name='communicator_objects.CompressedObservationProto.compression_type', index=1, |
|||
number=2, type=14, cpp_type=8, label=1, |
|||
has_default_value=False, default_value=0, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='data', full_name='communicator_objects.CompressedObservationProto.data', index=2, |
|||
number=3, type=12, cpp_type=9, label=1, |
|||
has_default_value=False, default_value=_b(""), |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
], |
|||
extensions=[ |
|||
], |
|||
nested_types=[], |
|||
enum_types=[ |
|||
], |
|||
options=None, |
|||
is_extendable=False, |
|||
syntax='proto3', |
|||
extension_ranges=[], |
|||
oneofs=[ |
|||
], |
|||
serialized_start=89, |
|||
serialized_end=216, |
|||
) |
|||
|
|||
_COMPRESSEDOBSERVATIONPROTO.fields_by_name['compression_type'].enum_type = _COMPRESSIONTYPEPROTO |
|||
DESCRIPTOR.message_types_by_name['CompressedObservationProto'] = _COMPRESSEDOBSERVATIONPROTO |
|||
DESCRIPTOR.enum_types_by_name['CompressionTypeProto'] = _COMPRESSIONTYPEPROTO |
|||
_sym_db.RegisterFileDescriptor(DESCRIPTOR) |
|||
|
|||
CompressedObservationProto = _reflection.GeneratedProtocolMessageType('CompressedObservationProto', (_message.Message,), dict( |
|||
DESCRIPTOR = _COMPRESSEDOBSERVATIONPROTO, |
|||
__module__ = 'mlagents.envs.communicator_objects.compressed_observation_pb2' |
|||
# @@protoc_insertion_point(class_scope:communicator_objects.CompressedObservationProto) |
|||
)) |
|||
_sym_db.RegisterMessage(CompressedObservationProto) |
|||
|
|||
|
|||
DESCRIPTOR.has_options = True |
|||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\252\002\034MLAgents.CommunicatorObjects')) |
|||
# @@protoc_insertion_point(module_scope) |
|
|||
# @generated by generate_proto_mypy_stubs.py. Do not edit! |
|||
import sys |
|||
from google.protobuf.descriptor import ( |
|||
Descriptor as google___protobuf___descriptor___Descriptor, |
|||
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor, |
|||
) |
|||
|
|||
from google.protobuf.internal.containers import ( |
|||
RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer, |
|||
) |
|||
|
|||
from google.protobuf.message import ( |
|||
Message as google___protobuf___message___Message, |
|||
) |
|||
|
|||
from typing import ( |
|||
Iterable as typing___Iterable, |
|||
List as typing___List, |
|||
Optional as typing___Optional, |
|||
Tuple as typing___Tuple, |
|||
cast as typing___cast, |
|||
) |
|||
|
|||
from typing_extensions import ( |
|||
Literal as typing_extensions___Literal, |
|||
) |
|||
|
|||
|
|||
builtin___bool = bool |
|||
builtin___bytes = bytes |
|||
builtin___float = float |
|||
builtin___int = int |
|||
builtin___str = str |
|||
|
|||
|
|||
class CompressionTypeProto(builtin___int): |
|||
DESCRIPTOR: google___protobuf___descriptor___EnumDescriptor = ... |
|||
@classmethod |
|||
def Name(cls, number: builtin___int) -> builtin___str: ... |
|||
@classmethod |
|||
def Value(cls, name: builtin___str) -> 'CompressionTypeProto': ... |
|||
@classmethod |
|||
def keys(cls) -> typing___List[builtin___str]: ... |
|||
@classmethod |
|||
def values(cls) -> typing___List['CompressionTypeProto']: ... |
|||
@classmethod |
|||
def items(cls) -> typing___List[typing___Tuple[builtin___str, 'CompressionTypeProto']]: ... |
|||
NONE = typing___cast('CompressionTypeProto', 0) |
|||
PNG = typing___cast('CompressionTypeProto', 1) |
|||
NONE = typing___cast('CompressionTypeProto', 0) |
|||
PNG = typing___cast('CompressionTypeProto', 1) |
|||
|
|||
class CompressedObservationProto(google___protobuf___message___Message): |
|||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... |
|||
shape = ... # type: google___protobuf___internal___containers___RepeatedScalarFieldContainer[builtin___int] |
|||
compression_type = ... # type: CompressionTypeProto |
|||
data = ... # type: builtin___bytes |
|||
|
|||
def __init__(self, |
|||
*, |
|||
shape : typing___Optional[typing___Iterable[builtin___int]] = None, |
|||
compression_type : typing___Optional[CompressionTypeProto] = None, |
|||
data : typing___Optional[builtin___bytes] = None, |
|||
) -> None: ... |
|||
@classmethod |
|||
def FromString(cls, s: builtin___bytes) -> CompressedObservationProto: ... |
|||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
if sys.version_info >= (3,): |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"compression_type",u"data",u"shape"]) -> None: ... |
|||
else: |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"compression_type",b"compression_type",u"data",b"data",u"shape",b"shape"]) -> None: ... |
|
|||
syntax = "proto3"; |
|||
|
|||
option csharp_namespace = "MLAgents.CommunicatorObjects"; |
|||
package communicator_objects; |
|||
|
|||
enum CompressionTypeProto { |
|||
NONE = 0; |
|||
PNG = 1; |
|||
} |
|||
|
|||
message CompressedObservationProto { |
|||
repeated int32 shape = 1; |
|||
CompressionTypeProto compression_type = 2; |
|||
bytes data = 3; |
|||
} |
|
|||
using System; |
|||
using MLAgents.InferenceBrain; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public class CameraSensor : ISensor |
|||
{ |
|||
private Camera m_Camera; |
|||
private int m_Width; |
|||
private int m_Height; |
|||
private bool m_Grayscale; |
|||
private string m_Name; |
|||
private int[] m_Shape; |
|||
|
|||
public CameraSensor(Camera camera, int width, int height, bool grayscale, string name) |
|||
{ |
|||
m_Camera = camera; |
|||
m_Width = width; |
|||
m_Height = height; |
|||
m_Grayscale = grayscale; |
|||
m_Name = name; |
|||
m_Shape = new[] { width, height, grayscale ? 1 : 3 }; |
|||
} |
|||
|
|||
public string GetName() |
|||
{ |
|||
return m_Name; |
|||
} |
|||
|
|||
public int[] GetFloatObservationShape() |
|||
{ |
|||
return m_Shape; |
|||
} |
|||
|
|||
public byte[] GetCompressedObservation() |
|||
{ |
|||
using (TimerStack.Instance.Scoped("CameraSensor.GetCompressedObservation")) |
|||
{ |
|||
var texture = ObservationToTexture(m_Camera, m_Width, m_Height); |
|||
// TODO support more types here, e.g. JPG
|
|||
var compressed = texture.EncodeToPNG(); |
|||
UnityEngine.Object.Destroy(texture); |
|||
return compressed; |
|||
} |
|||
} |
|||
|
|||
public void WriteToTensor(TensorProxy tensorProxy, int agentIndex) |
|||
{ |
|||
using (TimerStack.Instance.Scoped("CameraSensor.WriteToTensor")) |
|||
{ |
|||
var texture = ObservationToTexture(m_Camera, m_Width, m_Height); |
|||
Utilities.TextureToTensorProxy(texture, tensorProxy, m_Grayscale, agentIndex); |
|||
UnityEngine.Object.Destroy(texture); |
|||
} |
|||
} |
|||
|
|||
public CompressionType GetCompressionType() |
|||
{ |
|||
return CompressionType.PNG; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts a m_Camera and corresponding resolution to a 2D texture.
|
|||
/// </summary>
|
|||
/// <returns>The 2D texture.</returns>
|
|||
/// <param name="obsCamera">Camera.</param>
|
|||
/// <param name="width">Width of resulting 2D texture.</param>
|
|||
/// <param name="height">Height of resulting 2D texture.</param>
|
|||
/// <returns name="texture2D">Texture2D to render to.</returns>
|
|||
public static Texture2D ObservationToTexture(Camera obsCamera, int width, int height) |
|||
{ |
|||
var texture2D = new Texture2D(width, height, TextureFormat.RGB24, false); |
|||
var oldRec = obsCamera.rect; |
|||
obsCamera.rect = new Rect(0f, 0f, 1f, 1f); |
|||
var depth = 24; |
|||
var format = RenderTextureFormat.Default; |
|||
var readWrite = RenderTextureReadWrite.Default; |
|||
|
|||
var tempRt = |
|||
RenderTexture.GetTemporary(width, height, depth, format, readWrite); |
|||
|
|||
var prevActiveRt = RenderTexture.active; |
|||
var prevCameraRt = obsCamera.targetTexture; |
|||
|
|||
// render to offscreen texture (readonly from CPU side)
|
|||
RenderTexture.active = tempRt; |
|||
obsCamera.targetTexture = tempRt; |
|||
|
|||
obsCamera.Render(); |
|||
|
|||
texture2D.ReadPixels(new Rect(0, 0, texture2D.width, texture2D.height), 0, 0); |
|||
|
|||
obsCamera.targetTexture = prevCameraRt; |
|||
obsCamera.rect = oldRec; |
|||
RenderTexture.active = prevActiveRt; |
|||
RenderTexture.ReleaseTemporary(tempRt); |
|||
return texture2D; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 41cb6bf4b09974bf583f5b2fef0c08a7 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public class CameraSensorComponent : SensorComponent |
|||
{ |
|||
public new Camera camera; |
|||
public string sensorName = "CameraSensor"; |
|||
public int width = 84; |
|||
public int height = 84; |
|||
public bool grayscale = false; |
|||
|
|||
public override ISensor CreateSensor() |
|||
{ |
|||
return new CameraSensor(camera, width, height, grayscale, sensorName); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 282f342c2ab144bf38be65d4d0c4e07d |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using MLAgents.InferenceBrain; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public struct CompressedObservation |
|||
{ |
|||
/// <summary>
|
|||
/// The compressed data.
|
|||
/// </summary>
|
|||
public byte[] Data; |
|||
|
|||
/// <summary>
|
|||
/// The format of the compressed data
|
|||
/// </summary>
|
|||
public CompressionType CompressionType; |
|||
|
|||
/// <summary>
|
|||
/// The uncompressed dimensions of the data.
|
|||
/// E.g. for RGB visual observations, this will be {Width, Height, 3}
|
|||
/// </summary>
|
|||
public int[] Shape; |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e9292f3e3b1864e0fbe1e9bb9a29d4ed |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using MLAgents.InferenceBrain; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public enum CompressionType |
|||
{ |
|||
None, |
|||
PNG, |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Sensor interface for generating observations.
|
|||
/// For custom implementations, it is recommended to SensorBase instead.
|
|||
/// </summary>
|
|||
public interface ISensor { |
|||
/// <summary>
|
|||
/// Returns the size of the observations that will be generated.
|
|||
/// For example, a sensor that observes the velocity of a rigid body (in 3D) would return new {3}.
|
|||
/// A sensor that returns an RGB image would return new [] {Width, Height, 3}
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
int[] GetFloatObservationShape(); |
|||
|
|||
/// <summary>
|
|||
/// Write the observation data directly to the TensorProxy.
|
|||
/// This is considered an advanced interface; for a simpler approach, use SensorBase and override WriteFloats instead.
|
|||
/// </summary>
|
|||
/// <param name="tensorProxy"></param>
|
|||
/// <param name="agentIndex"></param>
|
|||
void WriteToTensor(TensorProxy tensorProxy, int agentIndex); |
|||
|
|||
/// <summary>
|
|||
/// Return a compressed representation of the observation. For small observations, this should generally not be
|
|||
/// implemented. However, compressing large observations (such as visual results) can significantly improve
|
|||
/// model training time.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
byte[] GetCompressedObservation(); |
|||
|
|||
/// <summary>
|
|||
/// Return the compression type being used. If no compression is used, return CompressionType.None
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
CompressionType GetCompressionType(); |
|||
|
|||
/// <summary>
|
|||
/// Get the name of the sensor. This is used to ensure deterministic sorting of the sensors on an Agent,
|
|||
/// so the naming must be consistent across all sensors and agents.
|
|||
/// </summary>
|
|||
/// <returns>The name of the sensor</returns>
|
|||
string GetName(); |
|||
} |
|||
|
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4bb5e09a94c6d4cd9a46c60b084e4952 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Threading; |
|||
using MLAgents.InferenceBrain; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
class RenderTextureSensor : ISensor |
|||
{ |
|||
private RenderTexture m_RenderTexture; |
|||
private int m_Width; |
|||
private int m_Height; |
|||
private bool m_Grayscale; |
|||
private string m_Name; |
|||
private int[] m_Shape; |
|||
|
|||
public RenderTextureSensor(RenderTexture renderTexture, int width, int height, bool grayscale, string name) |
|||
{ |
|||
m_RenderTexture = renderTexture; |
|||
m_Width = width; |
|||
m_Height = height; |
|||
m_Grayscale = grayscale; |
|||
m_Name = name; |
|||
m_Shape = new[] { width, height, grayscale ? 1 : 3 }; |
|||
} |
|||
|
|||
public string GetName() |
|||
{ |
|||
return m_Name; |
|||
} |
|||
|
|||
public int[] GetFloatObservationShape() |
|||
{ |
|||
return m_Shape; |
|||
} |
|||
|
|||
public byte[] GetCompressedObservation() |
|||
{ |
|||
using(TimerStack.Instance.Scoped("RenderTexSensor.GetCompressedObservation")) |
|||
{ |
|||
var texture = ObservationToTexture(m_RenderTexture, m_Width, m_Height); |
|||
// TODO support more types here, e.g. JPG
|
|||
var compressed = texture.EncodeToPNG(); |
|||
UnityEngine.Object.Destroy(texture); |
|||
return compressed; |
|||
} |
|||
} |
|||
|
|||
public void WriteToTensor(TensorProxy tensorProxy, int index) |
|||
{ |
|||
using (TimerStack.Instance.Scoped("RenderTexSensor.GetCompressedObservation")) |
|||
{ |
|||
var texture = ObservationToTexture(m_RenderTexture, m_Width, m_Height); |
|||
Utilities.TextureToTensorProxy(texture, tensorProxy, m_Grayscale, index); |
|||
UnityEngine.Object.Destroy(texture); |
|||
} |
|||
} |
|||
|
|||
public CompressionType GetCompressionType() |
|||
{ |
|||
return CompressionType.PNG; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts a RenderTexture and correspinding resolution to a 2D texture.
|
|||
/// </summary>
|
|||
/// <returns>The 2D texture.</returns>
|
|||
/// <param name="obsTexture">RenderTexture.</param>
|
|||
/// <param name="width">Width of resulting 2D texture.</param>
|
|||
/// <param name="height">Height of resulting 2D texture.</param>
|
|||
/// <returns name="texture2D">Texture2D to render to.</returns>
|
|||
public static Texture2D ObservationToTexture(RenderTexture obsTexture, int width, int height) |
|||
{ |
|||
var texture2D = new Texture2D(width, height, TextureFormat.RGB24, false); |
|||
|
|||
if (width != texture2D.width || height != texture2D.height) |
|||
{ |
|||
texture2D.Resize(width, height); |
|||
} |
|||
|
|||
if (width != obsTexture.width || height != obsTexture.height) |
|||
{ |
|||
throw new UnityAgentsException(string.Format( |
|||
"RenderTexture {0} : width/height is {1}/{2} brain is expecting {3}/{4}.", |
|||
obsTexture.name, obsTexture.width, obsTexture.height, width, height)); |
|||
} |
|||
|
|||
var prevActiveRt = RenderTexture.active; |
|||
RenderTexture.active = obsTexture; |
|||
|
|||
texture2D.ReadPixels(new Rect(0, 0, texture2D.width, texture2D.height), 0, 0); |
|||
texture2D.Apply(); |
|||
RenderTexture.active = prevActiveRt; |
|||
return texture2D; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 958f1f6bb9058405cae3c03266ad9899 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public class RenderTextureSensorComponent : SensorComponent |
|||
{ |
|||
public RenderTexture renderTexture; |
|||
public string sensorName = "RenderTextureSensor"; |
|||
public int width = 84; |
|||
public int height = 84; |
|||
public bool grayscale = false; |
|||
|
|||
public override ISensor CreateSensor() |
|||
{ |
|||
return new RenderTextureSensor(renderTexture, width, height, grayscale, sensorName); |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 132e1194facb64429b007ea1edf562d0 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using MLAgents.InferenceBrain; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
public abstract class SensorBase : ISensor |
|||
{ |
|||
/// <summary>
|
|||
/// Write the observations to the output buffer. This size of the buffer will be product of the sizes returned
|
|||
/// by GetFloatObservationShape().
|
|||
/// </summary>
|
|||
/// <param name="output"></param>
|
|||
public abstract void WriteObservation(float[] output); |
|||
|
|||
public abstract int[] GetFloatObservationShape(); |
|||
|
|||
public abstract string GetName(); |
|||
|
|||
/// <summary>
|
|||
/// Default implementation of WriteToTensor interface. This creates a temporary array, calls WriteObservation,
|
|||
/// and then writes the results to the TensorProxy.
|
|||
/// </summary>
|
|||
/// <param name="tensorProxy"></param>
|
|||
/// <param name="agentIndex"></param>
|
|||
public virtual void WriteToTensor(TensorProxy tensorProxy, int agentIndex) |
|||
{ |
|||
// TODO reuse buffer for similar agents, don't call GetFloatObservationShape()
|
|||
int[] shape = GetFloatObservationShape(); |
|||
int numFloats = 1; |
|||
foreach (var dim in shape) |
|||
{ |
|||
numFloats *= dim; |
|||
} |
|||
|
|||
float[] buffer = new float[numFloats]; |
|||
WriteObservation(buffer); |
|||
|
|||
for (var i = 0; i < numFloats; i++) |
|||
{ |
|||
tensorProxy.data[agentIndex, i] = buffer[i]; |
|||
} |
|||
} |
|||
|
|||
public virtual byte[] GetCompressedObservation() |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
public virtual CompressionType GetCompressionType() |
|||
{ |
|||
return CompressionType.None; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 553b05a1b59a94260b3e545f13190389 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEngine; |
|||
|
|||
namespace MLAgents.Sensor |
|||
{ |
|||
/// <summary>
|
|||
/// Editor components for creating Sensors. Generally an ISensor implementation should have a corresponding
|
|||
/// SensorComponent to create it.
|
|||
/// </summary>
|
|||
public abstract class SensorComponent : MonoBehaviour |
|||
{ |
|||
/// <summary>
|
|||
/// Create the ISensor. This is called by the Agent when it is initialized.
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
public abstract ISensor CreateSensor(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 4f1dad589959a4b598d09e54f61fbe02 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
// <auto-generated>
|
|||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
|||
// source: mlagents/envs/communicator_objects/resolution.proto
|
|||
// </auto-generated>
|
|||
#pragma warning disable 1591, 0612, 3021
|
|||
#region Designer generated code
|
|||
|
|||
using pb = global::Google.Protobuf; |
|||
using pbc = global::Google.Protobuf.Collections; |
|||
using pbr = global::Google.Protobuf.Reflection; |
|||
using scg = global::System.Collections.Generic; |
|||
namespace MLAgents.CommunicatorObjects { |
|||
|
|||
/// <summary>Holder for reflection information generated from mlagents/envs/communicator_objects/resolution.proto</summary>
|
|||
public static partial class ResolutionReflection { |
|||
|
|||
#region Descriptor
|
|||
/// <summary>File descriptor for mlagents/envs/communicator_objects/resolution.proto</summary>
|
|||
public static pbr::FileDescriptor Descriptor { |
|||
get { return descriptor; } |
|||
} |
|||
private static pbr::FileDescriptor descriptor; |
|||
|
|||
static ResolutionReflection() { |
|||
byte[] descriptorData = global::System.Convert.FromBase64String( |
|||
string.Concat( |
|||
"CjNtbGFnZW50cy9lbnZzL2NvbW11bmljYXRvcl9vYmplY3RzL3Jlc29sdXRp", |
|||
"b24ucHJvdG8SFGNvbW11bmljYXRvcl9vYmplY3RzIkQKD1Jlc29sdXRpb25Q", |
|||
"cm90bxINCgV3aWR0aBgBIAEoBRIOCgZoZWlnaHQYAiABKAUSEgoKZ3JheV9z", |
|||
"Y2FsZRgDIAEoCEIfqgIcTUxBZ2VudHMuQ29tbXVuaWNhdG9yT2JqZWN0c2IG", |
|||
"cHJvdG8z")); |
|||
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, |
|||
new pbr::FileDescriptor[] { }, |
|||
new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { |
|||
new pbr::GeneratedClrTypeInfo(typeof(global::MLAgents.CommunicatorObjects.ResolutionProto), global::MLAgents.CommunicatorObjects.ResolutionProto.Parser, new[]{ "Width", "Height", "GrayScale" }, null, null, null) |
|||
})); |
|||
} |
|||
#endregion
|
|||
|
|||
} |
|||
#region Messages
|
|||
public sealed partial class ResolutionProto : pb::IMessage<ResolutionProto> { |
|||
private static readonly pb::MessageParser<ResolutionProto> _parser = new pb::MessageParser<ResolutionProto>(() => new ResolutionProto()); |
|||
private pb::UnknownFieldSet _unknownFields; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pb::MessageParser<ResolutionProto> Parser { get { return _parser; } } |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public static pbr::MessageDescriptor Descriptor { |
|||
get { return global::MLAgents.CommunicatorObjects.ResolutionReflection.Descriptor.MessageTypes[0]; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
pbr::MessageDescriptor pb::IMessage.Descriptor { |
|||
get { return Descriptor; } |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public ResolutionProto() { |
|||
OnConstruction(); |
|||
} |
|||
|
|||
partial void OnConstruction(); |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public ResolutionProto(ResolutionProto other) : this() { |
|||
width_ = other.width_; |
|||
height_ = other.height_; |
|||
grayScale_ = other.grayScale_; |
|||
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public ResolutionProto Clone() { |
|||
return new ResolutionProto(this); |
|||
} |
|||
|
|||
/// <summary>Field number for the "width" field.</summary>
|
|||
public const int WidthFieldNumber = 1; |
|||
private int width_; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int Width { |
|||
get { return width_; } |
|||
set { |
|||
width_ = value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>Field number for the "height" field.</summary>
|
|||
public const int HeightFieldNumber = 2; |
|||
private int height_; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int Height { |
|||
get { return height_; } |
|||
set { |
|||
height_ = value; |
|||
} |
|||
} |
|||
|
|||
/// <summary>Field number for the "gray_scale" field.</summary>
|
|||
public const int GrayScaleFieldNumber = 3; |
|||
private bool grayScale_; |
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool GrayScale { |
|||
get { return grayScale_; } |
|||
set { |
|||
grayScale_ = value; |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override bool Equals(object other) { |
|||
return Equals(other as ResolutionProto); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public bool Equals(ResolutionProto other) { |
|||
if (ReferenceEquals(other, null)) { |
|||
return false; |
|||
} |
|||
if (ReferenceEquals(other, this)) { |
|||
return true; |
|||
} |
|||
if (Width != other.Width) return false; |
|||
if (Height != other.Height) return false; |
|||
if (GrayScale != other.GrayScale) return false; |
|||
return Equals(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override int GetHashCode() { |
|||
int hash = 1; |
|||
if (Width != 0) hash ^= Width.GetHashCode(); |
|||
if (Height != 0) hash ^= Height.GetHashCode(); |
|||
if (GrayScale != false) hash ^= GrayScale.GetHashCode(); |
|||
if (_unknownFields != null) { |
|||
hash ^= _unknownFields.GetHashCode(); |
|||
} |
|||
return hash; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public override string ToString() { |
|||
return pb::JsonFormatter.ToDiagnosticString(this); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void WriteTo(pb::CodedOutputStream output) { |
|||
if (Width != 0) { |
|||
output.WriteRawTag(8); |
|||
output.WriteInt32(Width); |
|||
} |
|||
if (Height != 0) { |
|||
output.WriteRawTag(16); |
|||
output.WriteInt32(Height); |
|||
} |
|||
if (GrayScale != false) { |
|||
output.WriteRawTag(24); |
|||
output.WriteBool(GrayScale); |
|||
} |
|||
if (_unknownFields != null) { |
|||
_unknownFields.WriteTo(output); |
|||
} |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public int CalculateSize() { |
|||
int size = 0; |
|||
if (Width != 0) { |
|||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Width); |
|||
} |
|||
if (Height != 0) { |
|||
size += 1 + pb::CodedOutputStream.ComputeInt32Size(Height); |
|||
} |
|||
if (GrayScale != false) { |
|||
size += 1 + 1; |
|||
} |
|||
if (_unknownFields != null) { |
|||
size += _unknownFields.CalculateSize(); |
|||
} |
|||
return size; |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(ResolutionProto other) { |
|||
if (other == null) { |
|||
return; |
|||
} |
|||
if (other.Width != 0) { |
|||
Width = other.Width; |
|||
} |
|||
if (other.Height != 0) { |
|||
Height = other.Height; |
|||
} |
|||
if (other.GrayScale != false) { |
|||
GrayScale = other.GrayScale; |
|||
} |
|||
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); |
|||
} |
|||
|
|||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute] |
|||
public void MergeFrom(pb::CodedInputStream input) { |
|||
uint tag; |
|||
while ((tag = input.ReadTag()) != 0) { |
|||
switch(tag) { |
|||
default: |
|||
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); |
|||
break; |
|||
case 8: { |
|||
Width = input.ReadInt32(); |
|||
break; |
|||
} |
|||
case 16: { |
|||
Height = input.ReadInt32(); |
|||
break; |
|||
} |
|||
case 24: { |
|||
GrayScale = input.ReadBool(); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
#endregion
|
|||
|
|||
} |
|||
|
|||
#endregion Designer generated code
|
|
|||
# Generated by the protocol buffer compiler. DO NOT EDIT! |
|||
# source: mlagents/envs/communicator_objects/resolution.proto |
|||
|
|||
import sys |
|||
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
|||
from google.protobuf import descriptor as _descriptor |
|||
from google.protobuf import message as _message |
|||
from google.protobuf import reflection as _reflection |
|||
from google.protobuf import symbol_database as _symbol_database |
|||
from google.protobuf import descriptor_pb2 |
|||
# @@protoc_insertion_point(imports) |
|||
|
|||
_sym_db = _symbol_database.Default() |
|||
|
|||
|
|||
|
|||
|
|||
DESCRIPTOR = _descriptor.FileDescriptor( |
|||
name='mlagents/envs/communicator_objects/resolution.proto', |
|||
package='communicator_objects', |
|||
syntax='proto3', |
|||
serialized_pb=_b('\n3mlagents/envs/communicator_objects/resolution.proto\x12\x14\x63ommunicator_objects\"D\n\x0fResolutionProto\x12\r\n\x05width\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x05\x12\x12\n\ngray_scale\x18\x03 \x01(\x08\x42\x1f\xaa\x02\x1cMLAgents.CommunicatorObjectsb\x06proto3') |
|||
) |
|||
|
|||
|
|||
|
|||
|
|||
_RESOLUTIONPROTO = _descriptor.Descriptor( |
|||
name='ResolutionProto', |
|||
full_name='communicator_objects.ResolutionProto', |
|||
filename=None, |
|||
file=DESCRIPTOR, |
|||
containing_type=None, |
|||
fields=[ |
|||
_descriptor.FieldDescriptor( |
|||
name='width', full_name='communicator_objects.ResolutionProto.width', index=0, |
|||
number=1, type=5, cpp_type=1, label=1, |
|||
has_default_value=False, default_value=0, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='height', full_name='communicator_objects.ResolutionProto.height', index=1, |
|||
number=2, type=5, cpp_type=1, label=1, |
|||
has_default_value=False, default_value=0, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
_descriptor.FieldDescriptor( |
|||
name='gray_scale', full_name='communicator_objects.ResolutionProto.gray_scale', index=2, |
|||
number=3, type=8, cpp_type=7, label=1, |
|||
has_default_value=False, default_value=False, |
|||
message_type=None, enum_type=None, containing_type=None, |
|||
is_extension=False, extension_scope=None, |
|||
options=None, file=DESCRIPTOR), |
|||
], |
|||
extensions=[ |
|||
], |
|||
nested_types=[], |
|||
enum_types=[ |
|||
], |
|||
options=None, |
|||
is_extendable=False, |
|||
syntax='proto3', |
|||
extension_ranges=[], |
|||
oneofs=[ |
|||
], |
|||
serialized_start=77, |
|||
serialized_end=145, |
|||
) |
|||
|
|||
DESCRIPTOR.message_types_by_name['ResolutionProto'] = _RESOLUTIONPROTO |
|||
_sym_db.RegisterFileDescriptor(DESCRIPTOR) |
|||
|
|||
ResolutionProto = _reflection.GeneratedProtocolMessageType('ResolutionProto', (_message.Message,), dict( |
|||
DESCRIPTOR = _RESOLUTIONPROTO, |
|||
__module__ = 'mlagents.envs.communicator_objects.resolution_pb2' |
|||
# @@protoc_insertion_point(class_scope:communicator_objects.ResolutionProto) |
|||
)) |
|||
_sym_db.RegisterMessage(ResolutionProto) |
|||
|
|||
|
|||
DESCRIPTOR.has_options = True |
|||
DESCRIPTOR._options = _descriptor._ParseOptions(descriptor_pb2.FileOptions(), _b('\252\002\034MLAgents.CommunicatorObjects')) |
|||
# @@protoc_insertion_point(module_scope) |
|
|||
# @generated by generate_proto_mypy_stubs.py. Do not edit! |
|||
import sys |
|||
from google.protobuf.descriptor import ( |
|||
Descriptor as google___protobuf___descriptor___Descriptor, |
|||
) |
|||
|
|||
from google.protobuf.message import ( |
|||
Message as google___protobuf___message___Message, |
|||
) |
|||
|
|||
from typing import ( |
|||
Optional as typing___Optional, |
|||
) |
|||
|
|||
from typing_extensions import ( |
|||
Literal as typing_extensions___Literal, |
|||
) |
|||
|
|||
|
|||
builtin___bool = bool |
|||
builtin___bytes = bytes |
|||
builtin___float = float |
|||
builtin___int = int |
|||
|
|||
|
|||
class ResolutionProto(google___protobuf___message___Message): |
|||
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ... |
|||
width = ... # type: builtin___int |
|||
height = ... # type: builtin___int |
|||
gray_scale = ... # type: builtin___bool |
|||
|
|||
def __init__(self, |
|||
*, |
|||
width : typing___Optional[builtin___int] = None, |
|||
height : typing___Optional[builtin___int] = None, |
|||
gray_scale : typing___Optional[builtin___bool] = None, |
|||
) -> None: ... |
|||
@classmethod |
|||
def FromString(cls, s: builtin___bytes) -> ResolutionProto: ... |
|||
def MergeFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
def CopyFrom(self, other_msg: google___protobuf___message___Message) -> None: ... |
|||
if sys.version_info >= (3,): |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"gray_scale",u"height",u"width"]) -> None: ... |
|||
else: |
|||
def ClearField(self, field_name: typing_extensions___Literal[u"gray_scale",b"gray_scale",u"height",b"height",u"width",b"width"]) -> None: ... |
|
|||
syntax = "proto3"; |
|||
|
|||
option csharp_namespace = "MLAgents.CommunicatorObjects"; |
|||
package communicator_objects; |
|||
|
|||
message ResolutionProto { |
|||
int32 width = 1; |
|||
int32 height = 2; |
|||
bool gray_scale = 3; |
|||
} |
|||
|
撰写
预览
正在加载...
取消
保存
Reference in new issue