示例#1
0
    protected override void Run(ModelProto model)
    {
        // Should this not be before loading input? Is the abstract base really that good?

        var dimParamOrValue = int.TryParse(Dim, out var dimValue)
            ? DimParamOrValue.New(dimValue)
            : DimParamOrValue.New(Dim);

        _console.WriteLine($"Setting dimension at {Index} to '{dimParamOrValue}'");

        model.Graph.SetDim(Index, dimParamOrValue);
    }
示例#2
0
        public void SetDim()
        {
            // Arrange
            var model = ModelProto.Parser.ParseFrom(m_createStream);

            // Act
            model.Graph.SetDim(dimIndex: 0, DimParamOrValue.New("N"));

            // Assert
            var graph = model.Graph;

            Assert.AreEqual(9, graph.Input.Count);
            Assert.AreEqual(1, graph.Output.Count);
            var expectedName = $"mnist-8-expected-{nameof(SetDim)}.onnx";

            AssertModelBytesEqualToEmbeddedExpected(model, expectedName);
        }