as -o test.o test.s && ld -o test test.o && ./test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import math | |
import random | |
import chainer | |
import chainer.functions as F | |
import chainer.links as L | |
import numpy as np | |
from chainer import reporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import random | |
import math | |
import cv2 | |
from PIL import Image | |
import sys | |
def detect_markers(im): | |
markers = [] | |
# 輪郭線抽出のための二値化 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
static class Program | |
{ | |
static void M(Action<int> a) | |
{ | |
a(10); | |
} | |
static void Main() |
Training TensorFlow models in C
Python is the primary language in which TensorFlow models are typically developed and trained. TensorFlow does have bindings for other programming languages. These bindings have the low-level primitives that are required to build a more complete API, however, lack much of the higher-level API richness of the Python bindings, particularly for defining the model structure.
This gist demonstrates taking a model (a TensorFlow graph) created by a Python program and running the training loop in a C program.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
class X { } | |
class Y { } | |
public class Program | |
{ | |
static void Main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
// https://gist.github.com/AArnott/d285feef75c18f6ecd2b と同種の最適化、デリゲートの引数変換にも使えそうという話。 | |
static class DelegateAdapter | |
{ | |
// こっちだと、action をフィールドに持つクラスが1個作られて、 | |
// var temp = new その匿名クラス(); | |
// new Action(temp.Method); | |
// みたいなコードになる。 | |
public static Action<int> ConvertSlow(Action<Alias> action) => x => action(new Alias(x)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.IO; | |
using System.Linq; | |
using System.Threading.Tasks; | |
namespace FfmpegPipeSandbox | |
{ | |
class Program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
using System.Threading.Tasks; | |
interface ICovariant<T> // Task<T> とか (bool, T) を含むので out は付けれない | |
where T : class | |
{ | |
T A(); | |
Task<T> B(); | |
(bool, T) C(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.InteropServices; | |
class Base { } | |
class Derived : Base | |
{ | |
// 1個や2個だと「たまたま0詰め」な領域を指すかもしれないので無駄にたくさんフィールド並べる | |
public long A { get; } | |
public long B { get; } | |
public long C { get; } |
NewerOlder