Files
2026-07-13 12:47:05 +08:00

75 lines
3.0 KiB
Plaintext

/* ******************************************************************************
*
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0.
*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* SPDX-License-Identifier: Apache-2.0
******************************************************************************/
include "node.fbs";
include "config.fbs";
include "variable.fbs";
include "utils.fbs";
include "result.fbs";
include "request.fbs";
include "array.fbs";
namespace graph;
table UpdaterState {
paramName:string; //Name of the parameter the updater state is for
updaterStateKeys:[string]; //Name of the updater state key (for example: "M" or "V" for Adam updater)
updaterStateValues:[FlatArray]; //Value of corresponding updater state key (for example: array for "M" updater state in Adam updater)
}
table SameDiffSubInstance {
name:string; // Name/identifier of the sub-instance
serializedData:[ubyte]; // Serialized FlatGraph data for the sub-instance
}
table FlatGraph {
id:long; // id of the graph
variables:[FlatVariable]; // list of variables
nodes:[FlatNode]; // list of nodes
outputs:[IntPair]; // list of output variables or nodes, in format of IntPair.first is node Id, IntPair.second is output index of the node
configuration:FlatConfiguration; // optional execution configuration
placeholders:[string]; // Placeholders. Used for SameDiff serialization/deserialization
lossVariables:[string]; // Variables that are marked as losses. Used for training.
trainingConfig:string; // JSON representation of training configuration. JSON used for custom functionality
updaterState:[UpdaterState]; // Updater state
// New fields for metadata
metadataKeys:[string]; // Keys for metadata
metadataValues:[string]; // Values for metadata (indexed same as keys)
// New field for sub-instances
subInstances:[SameDiffSubInstance]; // Sub-instances of SameDiff (nested graphs)
}
table FlatDropRequest {
id:long; // id of the graph to be droppoed
}
table FlatResponse {
status:int; // status of operation
}
rpc_service GraphInferenceServer {
RegisterGraph(FlatGraph):FlatResponse;
ForgetGraph(FlatDropRequest):FlatResponse;
ReplaceGraph(FlatGraph):FlatResponse;
InferenceRequest(FlatInferenceRequest):FlatResult;
}
root_type FlatGraph;