.NET-HILFE

TensorFlow .NET (Wie es für Entwickler funktioniert)

Maschinelles Lernen (ML) hat verschiedene Branchen revolutioniert, von der Gesundheitsversorgung bis zum Finanzwesen, indem es intelligentes Entscheiden und Automatisierung ermöglicht. TensorFlow, Googles Open-Source-ML- und Deep-Learning-Framework, steht an der Spitze dieser Revolution. Mit TensorFlow.NET können .NET-Entwickler die Leistungsfähigkeit von TensorFlow innerhalb des C#-Ökosystems nutzen. In diesem Artikel werden wir TensorFlow.NET, seine Funktionen, Vorteile und praktische Anwendungen in der C#-Entwicklung erkunden. Außerdem werden wir mit einem praktischen Beispiel mehr über eine PDF-Generierungsbibliothek namens IronPDF von Iron Software lernen.

Verstehen von TensorFlow.NET

TensorFlow.NET ist eine .NET-Bindung für TensorFlow, die es Entwicklern ermöglicht, TensorFlow-Funktionen direkt innerhalb von C#- und .NET-Anwendungsebenen zu nutzen. Entwickelt von der Community und gepflegt von der SciSharp-Organisation, bietet TensorFlow.NET eine nahtlose Integration der Fähigkeiten von TensorFlow für maschinelles Lernen und neuronale Netze mit der Vielseitigkeit der .NET-Plattform. Es ermöglicht C#-Entwicklern, neuronale Netze zu erstellen, Modelle oder Trainingsbilder zu trainieren und ML-Modelle unter Verwendung der umfangreichen System-APIs und Werkzeuge von TensorFlow einzusetzen.

Hauptmerkmale von TensorFlow.NET

  1. TensorFlow-Kompatibilität: TensorFlow.NET bietet volle Kompatibilität mit den APIs und Operationen von TensorFlow, einschließlich Tensormanipulation oder Aktivierung, neuronalen Netzwerkschichten, Verlustfunktionen, Optimierern und Hilfsprogrammen für die Datenvorverarbeitung und -bewertung.

  2. Hohe Leistung: TensorFlow.NET nutzt TensorFlows effizientes Ausführungs-Engine für Rechenflussdiagramme und optimierte Kernel, um eine leistungsstarke maschinelle Lerninferenz und -schulung auf CPUs und GPUs zu ermöglichen.

  3. Einfache Integration: TensorFlow.NET integriert sich nahtlos in bestehende .NET-Anwendungen und -Bibliotheken, sodass Entwickler die Fähigkeiten von TensorFlow nutzen können, ohne die vertraute C#-Entwicklungsumgebung zu verlassen.

  4. Modell-Portabilität: TensorFlow.NET ermöglicht es Entwicklern, vortrainierte TensorFlow-Modelle zu importieren und trainierte Modelle für Inferenz in anderen TensorFlow-basierten Umgebungen, wie Python oder mobilen Geräten, zu exportieren.

  5. Flexibilität und Erweiterbarkeit: TensorFlow.NET bietet Flexibilität zur Anpassung und Erweiterung von maschinellen Lernmodellen unter Verwendung von C#-Sprachmerkmalen, wie z.B. LINQ (Language Integrated Query) für die Datenmanipulation und funktionale Programmierparadigmen für die Modellzusammensetzung.

  6. Community-Unterstützung und Dokumentation: TensorFlow.NET profitiert von einer aktiven Gemeinschaft von Mitwirkenden, die Dokumentation, Tutorials und Beispiele bereitstellen, um Entwicklern den Einstieg in maschinelles Lernen in der C#-Welt mit TensorFlow zu erleichtern.

Praktische Beispiele mit TensorFlow.NET

Lassen Sie uns einige praktische Szenarien erkunden, in denen TensorFlow.NET verwendet werden kann, um Machine-Learning-Modelle in C# zu erstellen und bereitzustellen:

  1. Laden und Verwenden vortrainierter Modelle:
    // Load a pre-trained TensorFlow model
    var model = TensorFlowModel.LoadModel("model.pb");
    // Perform inference on input data
    var input = new float[,] { { 1.0f, 2.0f, 3.0f } };
    var output = model.Predict(input);
    // Load a pre-trained TensorFlow model
    var model = TensorFlowModel.LoadModel("model.pb");
    // Perform inference on input data
    var input = new float[,] { { 1.0f, 2.0f, 3.0f } };
    var output = model.Predict(input);
' Load a pre-trained TensorFlow model
	Dim model = TensorFlowModel.LoadModel("model.pb")
	' Perform inference on input data
	Dim input = New Single(, ) {
		{ 1.0F, 2.0F, 3.0F }
	}
	Dim output = model.Predict(input)
$vbLabelText   $csharpLabel
  1. Anpassen von Modellen:
    // Create a neural network model using TensorFlow.NET APIs and metrics
    var input = new Input(Shape.Scalar);
    var output = new Dense(1, Activation.ReLU).Forward(input);
    // Compile the model with loss function and optimizer algorithms
    var model = new Model(input, output);
    model.Compile(optimizer: new SGD(), loss: Losses.MeanSquaredError);
    // Train the model with training data just like Python
    model.Fit(x_train, y_train, epochs: 10, batchSize: 32);
    // Create a neural network model using TensorFlow.NET APIs and metrics
    var input = new Input(Shape.Scalar);
    var output = new Dense(1, Activation.ReLU).Forward(input);
    // Compile the model with loss function and optimizer algorithms
    var model = new Model(input, output);
    model.Compile(optimizer: new SGD(), loss: Losses.MeanSquaredError);
    // Train the model with training data just like Python
    model.Fit(x_train, y_train, epochs: 10, batchSize: 32);
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel
  1. Bewertung und Bereitstellung:
    // Evaluate the trained model on test data
    var evaluation = model.Evaluate(x_test, y_test);
    // Export the trained model for deployment
    model.SaveModel("trained_model.pb");
    // Evaluate the trained model on test data
    var evaluation = model.Evaluate(x_test, y_test);
    // Export the trained model for deployment
    model.SaveModel("trained_model.pb");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Weitere Beispiele für TensorFlow finden Sie auf der Seite TensorFlow.NET Examples.

// static Tensorflow
using static Tensorflow.Binding;
namespace IronPdfDemos
{
    public class TensorFlow
    {
        public static void Execute()
        {
            var hello = tf.constant("Hello, TensorFlow!");
            Console.WriteLine(hello);
        }
    }
}
// static Tensorflow
using static Tensorflow.Binding;
namespace IronPdfDemos
{
    public class TensorFlow
    {
        public static void Execute()
        {
            var hello = tf.constant("Hello, TensorFlow!");
            Console.WriteLine(hello);
        }
    }
}
' static Tensorflow
Imports Tensorflow.Binding
Namespace IronPdfDemos
	Public Class TensorFlow
		Public Shared Sub Execute()
			Dim hello = tf.constant("Hello, TensorFlow!")
			Console.WriteLine(hello)
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

Beispiel Hello TensorFlow Ausgabe

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 1 - Konsolenanwendung Ausgabe

Vorteile der Verwendung von TensorFlow.NET

  1. Nahtlose Integration: TensorFlow.NET bringt die Leistungsfähigkeit von TensorFlow in das .NET-Ökosystem und ermöglicht C#-Entwicklern, modernste Techniken und Algorithmen des maschinellen Lernens in ihren Anwendungen zu nutzen.

  2. Leistung und Skalierbarkeit: TensorFlow.NET nutzt TensorFlows optimierte Ausführungs-Engine, um hochleistungsfähige maschinelle Lernberechnungen bereitzustellen, und ist damit geeignet für die Verarbeitung von groß angelegten Datensätzen, Testbildern und komplexen oder dichten Modellen.

  3. Vertraute Entwicklungsumgebung: Die TensorFlow.NET API ermöglicht Entwicklern, Machine-Learning-Modelle mit vertrauten C# Sprachfunktionen und Entwicklungstools zu erstellen und bereitzustellen, was die Lernkurve für die Einführung von Machine Learning in C# Anwendungen reduziert.

  4. Interoperabilität und Portabilität: TensorFlow.NET ermöglicht die Interoperabilität mit anderen auf TensorFlow basierenden Umgebungen, wodurch eine nahtlose Integration von auf C# basierenden Machine-Learning-Modellen mit Python, TensorFlow Serving und TensorFlow Lite möglich ist.

  5. Community-getriebene Entwicklung: TensorFlow.NET profitiert von einer aktiven Gemeinschaft von Mitwirkenden und Nutzern, die Unterstützung, Feedback und Beiträge zum Projekt leisten, um dessen kontinuierliches Wachstum und Verbesserung sicherzustellen.

TensorFlow.NET Lizenz

Es ist ein Open-Source-Paket mit Apache-Lizenz, das frei verwendet werden kann. Mehr über die Lizenz erfahren Sie auf der TensorFlow.NET-Lizenz-Seite.

Einführung in IronPDF

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 2 - IronPDF

IronPDF ist eine leistungsstarke C# PDF-Bibliothek, die es Entwicklern ermöglicht, PDFs direkt aus HTML-, CSS-, Bild- und JavaScript-Eingaben zu erstellen, zu bearbeiten und zu signieren. Es handelt sich um eine kommerzielle Lösung mit hoher Leistung und geringem Speicherbedarf. Hier sind einige der wichtigsten Merkmale:

  1. HTML zu PDF Konvertierung: IronPDF kann HTML-Dateien, HTML-Strings und URLs in PDFs umwandeln. So können Sie beispielsweise eine Webseite mit dem Chrome PDF-Renderer als PDF wiedergeben.

  2. Plattformübergreifende Unterstützung: IronPDF funktioniert auf verschiedenen .NET-Plattformen, einschließlich .NET Core, .NET Standard und .NET Framework. Es ist kompatibel mit Windows, Linux und macOS.

  3. Bearbeiten und Signieren: Sie können Eigenschaften festlegen, Sicherheit (Passwörter und Berechtigungen) hinzufügen und sogar digitale Signaturen auf Ihre PDFs anwenden.

  4. Seitenschablonen und -einstellungen: Passen Sie Ihre PDFs an, indem Sie Kopfzeilen, Fußzeilen und Seitenzahlen hinzufügen und die Ränder anpassen. IronPDF unterstützt auch responsive Layouts und benutzerdefinierte Papiergrößen.

  5. Standardkonformität: IronPDF entspricht PDF-Standards wie PDF/A und PDF/UA. Es unterstützt die UTF-8-Zeichenkodierung und verarbeitet Assets wie Bilder, CSS und Schriftarten.

Erzeugen von PDF-Dokumenten mit TensorFlow.NET und IronPDF

Erstellen Sie zunächst ein Visual Studio-Projekt und wählen Sie die unten stehende Konsolenanwendungsvorlage aus.

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 3 - Visual Studio Projekt

Geben Sie den Projektnamen und den Standort an.

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 4 - Projekteinstellungen

Wählen Sie im nächsten Schritt die gewünschte .NET-Version aus und klicken Sie auf die Schaltfläche Erstellen.

Installieren Sie IronPDF aus dem NuGet-Paket im Visual Studio-Paket-Manager.

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 5 - TensorFlow .NET

Installieren Sie die Pakete TensorFlow.NET und TensorFlow.Keras, ein unabhängiges Paket zum Ausführen von Modellen.

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 6 - Paket TensorFlow.Keras installieren

using IronPdf;
using static Tensorflow.Binding;

namespace IronPdfDemos
{
    public class Program
    {
        public static void Main()
        {
            // Instantiate Cache and ChromePdfRenderer
            var renderer = new ChromePdfRenderer();

            // Prepare HTML
            var content = "<h1>Demonstrate TensorFlow with IronPDF</h1>";
            content += $"<p></p>";
            content += $"<h2></h2>";

            // Eager mode
            content += $"<h2>Enable Eager Execution</h2>";
            content += $"<p>tf.enable_eager_execution();</p>";

            // tf is a static TensorFlow instance
            tf.enable_eager_execution(); // Enable eager mode

            content += $"<h2>Define tensor constants.</h2>";
            // Introduce tensor constants
            var a = tf.constant(5);
            var b = tf.constant(6);
            var c = tf.constant(7);

            content += $"<p></p>";
            content += $"<p></p>";
            content += $"<p></p>";

            content += $"<h2>Various tensor operations.</h2>";
            // Various tensor operations usage
            // Note: Tensors also support operators (+, *, ...)
            var add = tf.add(a, b);
            var sub = tf.subtract(a, b);
            var mul = tf.multiply(a, b);
            var div = tf.divide(a, b);

            content += $"<p>var add = tf.add(a, b);</p>";
            content += $"<p>var sub = tf.subtract(a, b);</p>";
            content += $"<p>var mul = tf.multiply(a, b);</p>";
            content += $"<p>var div = tf.divide(a, b);</p>";

            content += $"<h2>Access tensors value.</h2>";
            // Tensors value
            print($"{(int)a} + {(int)b} = {(int)add}");
            print($"{(int)a} - {(int)b} = {(int)sub}");
            print($"{(int)a} * {(int)b} = {(int)mul}");
            print($"{(int)a} / {(int)b} = {(double)div}");

            content += $"<p>{(int)a} + {(int)b} = {(int)add}</p>";
            content += $"<p>{(int)a} - {(int)b} = {(int)sub}</p>";
            content += $"<p>{(int)a} * {(int)b} = {(int)mul}</p>";
            content += $"<p>{(int)a} / {(int)b} = {(double)div}</p>";

            // Some more operations
            var mean = tf.reduce_mean(tf.constant(new[] { a, b, c }));
            var sum = tf.reduce_sum(tf.constant(new[] { a, b, c }));

            content += $"<h2>Access tensors value.</h2>";
            // Access tensors value
            print("mean =", mean.numpy());
            print("sum =", sum.numpy());

            content += $"<p>mean = {mean.numpy()}</p>";
            content += $"<p>sum = {sum.numpy()}</p>";

            content += $"<h2>Matrix multiplications.</h2>";
            // Matrix multiplications with a single row
            var matrix1 = tf.constant(new float[,] { { 1, 2 }, { 3, 4 } });
            var matrix2 = tf.constant(new float[,] { { 5, 6 }, { 7, 8 } });
            var product = tf.matmul(matrix1, matrix2);

            content += "<p>matrix1 = tf.constant(new float[,] { { { 1, 2 }}, { { 3, 4 }} })</p>";
            content += "<p>matrix2 = tf.constant(new float[,] { { { 5, 6 }}, { { 7, 8 }} })</p>";
            content += "<p>product = tf.matmul(matrix1, matrix2)</p>";

            content += $"<h2>Convert Tensor to Numpy.</h2>";
            // Convert Tensor to Numpy
            print("product =", product.numpy());

            content += $"<p>product = {product.numpy()}</p>";

            // Create a PDF from an HTML string using C#
            var pdf = renderer.RenderHtmlAsPdf(content);
            // Export to a file or Stream
            pdf.SaveAs("tensorflow.pdf");
        }
    }
}
using IronPdf;
using static Tensorflow.Binding;

namespace IronPdfDemos
{
    public class Program
    {
        public static void Main()
        {
            // Instantiate Cache and ChromePdfRenderer
            var renderer = new ChromePdfRenderer();

            // Prepare HTML
            var content = "<h1>Demonstrate TensorFlow with IronPDF</h1>";
            content += $"<p></p>";
            content += $"<h2></h2>";

            // Eager mode
            content += $"<h2>Enable Eager Execution</h2>";
            content += $"<p>tf.enable_eager_execution();</p>";

            // tf is a static TensorFlow instance
            tf.enable_eager_execution(); // Enable eager mode

            content += $"<h2>Define tensor constants.</h2>";
            // Introduce tensor constants
            var a = tf.constant(5);
            var b = tf.constant(6);
            var c = tf.constant(7);

            content += $"<p></p>";
            content += $"<p></p>";
            content += $"<p></p>";

            content += $"<h2>Various tensor operations.</h2>";
            // Various tensor operations usage
            // Note: Tensors also support operators (+, *, ...)
            var add = tf.add(a, b);
            var sub = tf.subtract(a, b);
            var mul = tf.multiply(a, b);
            var div = tf.divide(a, b);

            content += $"<p>var add = tf.add(a, b);</p>";
            content += $"<p>var sub = tf.subtract(a, b);</p>";
            content += $"<p>var mul = tf.multiply(a, b);</p>";
            content += $"<p>var div = tf.divide(a, b);</p>";

            content += $"<h2>Access tensors value.</h2>";
            // Tensors value
            print($"{(int)a} + {(int)b} = {(int)add}");
            print($"{(int)a} - {(int)b} = {(int)sub}");
            print($"{(int)a} * {(int)b} = {(int)mul}");
            print($"{(int)a} / {(int)b} = {(double)div}");

            content += $"<p>{(int)a} + {(int)b} = {(int)add}</p>";
            content += $"<p>{(int)a} - {(int)b} = {(int)sub}</p>";
            content += $"<p>{(int)a} * {(int)b} = {(int)mul}</p>";
            content += $"<p>{(int)a} / {(int)b} = {(double)div}</p>";

            // Some more operations
            var mean = tf.reduce_mean(tf.constant(new[] { a, b, c }));
            var sum = tf.reduce_sum(tf.constant(new[] { a, b, c }));

            content += $"<h2>Access tensors value.</h2>";
            // Access tensors value
            print("mean =", mean.numpy());
            print("sum =", sum.numpy());

            content += $"<p>mean = {mean.numpy()}</p>";
            content += $"<p>sum = {sum.numpy()}</p>";

            content += $"<h2>Matrix multiplications.</h2>";
            // Matrix multiplications with a single row
            var matrix1 = tf.constant(new float[,] { { 1, 2 }, { 3, 4 } });
            var matrix2 = tf.constant(new float[,] { { 5, 6 }, { 7, 8 } });
            var product = tf.matmul(matrix1, matrix2);

            content += "<p>matrix1 = tf.constant(new float[,] { { { 1, 2 }}, { { 3, 4 }} })</p>";
            content += "<p>matrix2 = tf.constant(new float[,] { { { 5, 6 }}, { { 7, 8 }} })</p>";
            content += "<p>product = tf.matmul(matrix1, matrix2)</p>";

            content += $"<h2>Convert Tensor to Numpy.</h2>";
            // Convert Tensor to Numpy
            print("product =", product.numpy());

            content += $"<p>product = {product.numpy()}</p>";

            // Create a PDF from an HTML string using C#
            var pdf = renderer.RenderHtmlAsPdf(content);
            // Export to a file or Stream
            pdf.SaveAs("tensorflow.pdf");
        }
    }
}
Imports IronPdf
Imports Tensorflow.Binding

Namespace IronPdfDemos
	Public Class Program
		Public Shared Sub Main()
			' Instantiate Cache and ChromePdfRenderer
			Dim renderer = New ChromePdfRenderer()

			' Prepare HTML
			Dim content = "<h1>Demonstrate TensorFlow with IronPDF</h1>"
			content &= $"<p></p>"
			content &= $"<h2></h2>"

			' Eager mode
			content &= $"<h2>Enable Eager Execution</h2>"
			content &= $"<p>tf.enable_eager_execution();</p>"

			' tf is a static TensorFlow instance
			tf.enable_eager_execution() ' Enable eager mode

			content &= $"<h2>Define tensor constants.</h2>"
			' Introduce tensor constants
			Dim a = tf.constant(5)
			Dim b = tf.constant(6)
			Dim c = tf.constant(7)

			content &= $"<p></p>"
			content &= $"<p></p>"
			content &= $"<p></p>"

			content &= $"<h2>Various tensor operations.</h2>"
			' Various tensor operations usage
			' Note: Tensors also support operators (+, *, ...)
			Dim add = tf.add(a, b)
			Dim [sub] = tf.subtract(a, b)
			Dim mul = tf.multiply(a, b)
			Dim div = tf.divide(a, b)

			content &= $"<p>var add = tf.add(a, b);</p>"
			content &= $"<p>var sub = tf.subtract(a, b);</p>"
			content &= $"<p>var mul = tf.multiply(a, b);</p>"
			content &= $"<p>var div = tf.divide(a, b);</p>"

			content &= $"<h2>Access tensors value.</h2>"
			' Tensors value
			print($"{CInt(a)} + {CInt(b)} = {CInt(add)}")
			print($"{CInt(a)} - {CInt(b)} = {CInt([sub])}")
			print($"{CInt(a)} * {CInt(b)} = {CInt(mul)}")
			print($"{CInt(a)} / {CInt(b)} = {CDbl(div)}")

			content &= $"<p>{CInt(a)} + {CInt(b)} = {CInt(add)}</p>"
			content &= $"<p>{CInt(a)} - {CInt(b)} = {CInt([sub])}</p>"
			content &= $"<p>{CInt(a)} * {CInt(b)} = {CInt(mul)}</p>"
			content &= $"<p>{CInt(a)} / {CInt(b)} = {CDbl(div)}</p>"

			' Some more operations
			Dim mean = tf.reduce_mean(tf.constant( { a, b, c }))
			Dim sum = tf.reduce_sum(tf.constant( { a, b, c }))

			content &= $"<h2>Access tensors value.</h2>"
			' Access tensors value
			print("mean =", mean.numpy())
			print("sum =", sum.numpy())

			content &= $"<p>mean = {mean.numpy()}</p>"
			content &= $"<p>sum = {sum.numpy()}</p>"

			content &= $"<h2>Matrix multiplications.</h2>"
			' Matrix multiplications with a single row
			Dim matrix1 = tf.constant(New Single(, ) {
				{ 1, 2 },
				{ 3, 4 }
			})
			Dim matrix2 = tf.constant(New Single(, ) {
				{ 5, 6 },
				{ 7, 8 }
			})
			Dim product = tf.matmul(matrix1, matrix2)

			content &= "<p>matrix1 = tf.constant(new float[,] { { { 1, 2 }}, { { 3, 4 }} })</p>"
			content &= "<p>matrix2 = tf.constant(new float[,] { { { 5, 6 }}, { { 7, 8 }} })</p>"
			content &= "<p>product = tf.matmul(matrix1, matrix2)</p>"

			content &= $"<h2>Convert Tensor to Numpy.</h2>"
			' Convert Tensor to Numpy
			print("product =", product.numpy())

			content &= $"<p>product = {product.numpy()}</p>"

			' Create a PDF from an HTML string using C#
			Dim pdf = renderer.RenderHtmlAsPdf(content)
			' Export to a file or Stream
			pdf.SaveAs("tensorflow.pdf")
		End Sub
	End Class
End Namespace
$vbLabelText   $csharpLabel

Code Erläuterung

Schauen wir uns das Codeschnipsel genauer an:

  1. Importanweisungen:

    Der Code beginnt mit dem Importieren der erforderlichen Bibliotheken. Konkret:

    using IronPdf; // This imports the IronPDF package, which is used for working with PDF files.
    using static Tensorflow.Binding; // This imports the TensorFlow library, specifically the .NET standard binding.
    using IronPdf; // This imports the IronPDF package, which is used for working with PDF files.
    using static Tensorflow.Binding; // This imports the TensorFlow library, specifically the .NET standard binding.
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel
  1. Eager Execution:

    Die Zeile tf.enable_eager_execution(); aktiviert den Eager-Execution-Modus von TensorFlow. Bei der eifrigen Ausführung werden die Operationen sofort ausgewertet, was die Fehlersuche und die Interaktion mit Tensoren erleichtert.

  2. Tensorkonstanten definieren:

    Der Code definiert drei Tensor-Konstanten: a, b und c. Diese werden mit den Werten 5, 6 bzw. 7 initialisiert.

  3. Verschiedene Tensoroperationen:

    Die folgenden Tensoroperationen werden durchgeführt:

    var add = tf.add(a, b); // Adds a and b.
    var sub = tf.subtract(a, b); // Subtracts b from a.
    var mul = tf.multiply(a, b); // Multiplies a and b.
    var div = tf.divide(a, b); // Divides a by b.
    var add = tf.add(a, b); // Adds a and b.
    var sub = tf.subtract(a, b); // Subtracts b from a.
    var mul = tf.multiply(a, b); // Multiplies a and b.
    var div = tf.divide(a, b); // Divides a by b.
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel
  1. Zugriff auf Tensorwerte:

    Die Ergebnisse der Tensoroperationen werden mit der print-Funktion ausgegeben:

    print($"{(int)a} + {(int)b} = {(int)add}");
    print($"{(int)a} - {(int)b} = {(int)sub}");
    print($"{(int)a} * {(int)b} = {(int)mul}");
    print($"{(int)a} / {(int)b} = {(double)div}");
    print($"{(int)a} + {(int)b} = {(int)add}");
    print($"{(int)a} - {(int)b} = {(int)sub}");
    print($"{(int)a} * {(int)b} = {(int)mul}");
    print($"{(int)a} / {(int)b} = {(double)div}");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Beispiel Ausgabe:

- 5 + 6 = 11

- 5 - 6 = -1

- 5 * 6 = 30

- 5 / 6 = 0.8333333333333334
  1. Zusätzliche Operationen:

    Der Code berechnet den Mittelwert und die Summe der Konstanten [a, b, c].

  2. PDF-Erstellung:

    ChromePdfRenderer und RenderHtmlAsPdf von IronPDF werden verwendet, um den HTML-String in ein PDF-Dokument zu rendern.

Ausgabe

TensorFlow .NET (Wie es für Entwickler funktioniert): Abbildung 7 - PDF-Ausgabe

IronPDF-Lizenz

IronPDF benötigt eine Lizenz, um zu laufen. Mehr Informationen zur Lizenzierung finden Sie auf der IronPDF Lizenzierungsseite. Platzieren Sie den Schlüssel in der Datei appSettings.json, wie unten gezeigt.

{
  "IronPdf.License.LicenseKey": "The Key Here"
}

Schlussfolgerung

Zusammenfassend ermöglicht TensorFlow.NET C#-Entwicklern, die Welt des maschinellen Lernens und der künstlichen Intelligenz mit der Vielseitigkeit und Produktivität des .NET-Ökosystems zu erkunden. Unabhängig davon, ob Sie intelligente Anwendungen, Predictive-Analytics-Tools oder automatisierte Entscheidungsfindungssysteme entwickeln, bietet TensorFlow.NET ein leistungsstarkes und flexibles Framework, um das Potenzial des maschinellen Lernens in C# freizusetzen. Zusammen mit der IronPDF-Bibliothek von Iron Software können Entwickler fortgeschrittene Fähigkeiten erlangen, um moderne Anwendungen zu entwickeln.

Chipego
Software-Ingenieur
Chipego hat eine natürliche Fähigkeit zum Zuhören, die ihm hilft, Kundenprobleme zu verstehen und intelligente Lösungen anzubieten. Er trat dem Iron Software-Team 2023 bei, nachdem er einen Bachelor of Science in Informationstechnologie erworben hatte. IronPDF und IronOCR sind die beiden Produkte, auf die sich Chipego konzentriert hat, aber sein Wissen über alle Produkte wächst täglich, da er neue Wege findet, Kunden zu unterstützen. Er genießt die Zusammenarbeit bei Iron Software, da Teammitglieder aus dem gesamten Unternehmen ihre unterschiedlichen Erfahrungen einbringen und so zu effektiven, innovativen Lösungen beitragen. Wenn Chipego nicht an seinem Schreibtisch sitzt, kann man ihn oft bei einem guten Buch oder beim Fußballspielen antreffen.
< PREVIOUS
Stripe .NET (Wie es für Entwickler funktioniert)
NÄCHSTES >
Humanizer C# (Wie es für Entwickler funktioniert)