Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 17 13:13:26 2017
@author: agoswami
"""
class Car(object):
@staticmethod
def factory(type):
# Our application logic will be added here
def cnn_model_fn(features, labels, mode):
"""Model function for CNN."""
# Input Layer
input_layer = tf.reshape(features["x"], [-1, 32, 32, 3], name="input_tensor")
# Convolutional Layer #1
conv1 = tf.layers.conv2d(
inputs=input_layer,
filters=32,
def get_batch(x, y, batch_size):
# print("x shape : {0}".format(x.shape))
# print("y shape : {0}".format(y.shape))
n_samples = x.shape[0]
indices = np.random.choice(n_samples, batch_size)
return x[indices], y[indices], indices
# clear old variables
tf.reset_default_graph()
X = tf.placeholder(tf.float32, [None, 32, 32, 3], name="Input")
@abgoswam
abgoswam / pyclient_linux_dotnet_namedpipe.py
Created July 13, 2017 02:10
Python Client on Linux Using a .NET Core Named Pipe (via unix domain sockets)
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 12 19:06:38 2017
@author: agoswami
"""
#socket_echo_client_uds.py
import socket
import sys
import * as ort from 'onnxruntime-node';
// use an async context to call onnxruntime functions.
async function main() {
ort.InferenceSession
const session = await ort.InferenceSession.create('./model4.onnx');
// prepare feeds. use model input names as keys.
const feeds = {
import * as ort from 'onnxruntime-web';
// use an async context to call onnxruntime functions.
async function main() {
ort.InferenceSession
const session = await ort.InferenceSession.create('./model4.onnx', {
executionProviders: ["wasm"],
});
@abgoswam
abgoswam / csharpserver_dotnet_namedpipe.cs
Created July 13, 2017 02:13
C# Server using .NET Core Named Pipes
using System;
using System.IO;
using System.IO.Pipes;
using System.Text;
class PipeServerBinary
{
static void Main()
{
using (NamedPipeServerStream pipe = new NamedPipeServerStream("testpipe"))