SmartEngine  1.6.0
GraphInput.h
1 // Copyright (C) 2018 Astrocat Studios - All Rights Reserved
2 
3 #pragma once
4 
5 #include "Context.h"
6 #include "GraphNode.h"
7 
8 namespace SmartEngine
9 {
10 
11 #pragma pack(push, 4)
12 struct GraphInputCInfo : public GraphNodeCInfo
16 {
17 };
18 
23 {
27  int inputDimension = 1;
28 };
29 
34 {
43  int inputDimension = 1;
44 };
45 #pragma pack(pop)
46 
50 class SMARTENGINE_EXPORT IGraphInput : public IGraphNode
51 {
52 public:
53  SMARTENGINE_DECLARE_CLASS(IGraphInput)
54 };
55 
59 class SMARTENGINE_EXPORT IBufferInput : public IGraphInput
60 {
61 public:
62  SMARTENGINE_DECLARE_CLASS(IBufferInput)
63 
64 
65  virtual int64 GetRowCount() = 0;
68 
77  virtual void SetValues(const float* buffer, int64 bufferCount) = 0;
78 
82  virtual void ZeroData() = 0;
83 };
84 
96 class SMARTENGINE_EXPORT IComponentInput : public IGraphInput
97 {
98 public:
99  SMARTENGINE_DECLARE_CLASS(IComponentInput)
100 
101 
102  virtual ObjectPtr<IGraphNode> GetInputNode() const = 0;
107 };
108 
113 
118 
120 extern "C"
121 {
122  SMARTENGINE_EXPORT ObjPtr BufferInput_CreateInstance(const BufferInputCInfo& cinfo);
123  SMARTENGINE_EXPORT int64 BufferInput_GetRowCount(ObjPtr object);
124  SMARTENGINE_EXPORT void BufferInput_SetValues(ObjPtr object, const float* buffer, int64 bufferCount);
125  SMARTENGINE_EXPORT void BufferInput_ZeroData(ObjPtr object);
126 
127  SMARTENGINE_EXPORT ObjPtr ComponentInput_CreateInstance(const ComponentInputCInfo& cinfo);
128  SMARTENGINE_EXPORT ObjPtr ComponentInput_GetInputNode(ObjPtr object);
129 }
131 
132 } // namespace SmartEngine
SmartEngine::IGraphNode
A logical node in the AI graph. Some nodes, like NeuralNetwork, are composed of other nodes (neuron l...
Definition: GraphNode.h:34
SmartEngine::IBufferInput
Input node into the AI graph. Allows for specifying a tensor input.
Definition: GraphInput.h:60
SmartEngine::CreateComponentInput
SMARTENGINE_EXPORT ObjectPtr< IComponentInput > CreateComponentInput(const ComponentInputCInfo &cinfo)
Creates an instance of IComponentInput
SmartEngine::ComponentInputCInfo::inputDimension
int inputDimension
Dimension of the input. Graph nodes that feed into this input must have this exact dimension.
Definition: GraphInput.h:43
SmartEngine::IComponentInput
Input node into a component. At the time of component construction, a node can be fed into this input...
Definition: GraphInput.h:97
SmartEngine::IGraphInput
Base class for input nodes into the AI graph
Definition: GraphInput.h:51
SmartEngine::IBufferInput::ZeroData
virtual void ZeroData()=0
Zeros out all tensor data.
SmartEngine::IBufferInput::SetValues
virtual void SetValues(const float *buffer, int64 bufferCount)=0
Sets the data of the tensor, specified in row major order.
SmartEngine::ObjectPtr
Smart pointer to an IObject. Automatic ref counting.
Definition: ObjectPtr.h:16
SmartEngine
Definition: A2CTrainer.h:10
SmartEngine::ComponentInputCInfo
Data used to construct a component input instance
Definition: GraphInput.h:34
SmartEngine::BufferInputCInfo::inputDimension
int inputDimension
Dimension of the input, which is equivalent to the column count of the tensor.
Definition: GraphInput.h:27
SmartEngine::BufferInputCInfo
Data used to construct an IBufferInput instance
Definition: GraphInput.h:23
SmartEngine::GraphInputCInfo
Data used to construct an IGraphInput instance
Definition: GraphInput.h:16
SmartEngine::CreateBufferInput
SMARTENGINE_EXPORT ObjectPtr< IBufferInput > CreateBufferInput(const BufferInputCInfo &cinfo)
Creates an instance of IBufferInput