Skip to content

Instantly share code, notes, and snippets.

View branislav1991's full-sized avatar

Branislav Holländer branislav1991

View GitHub Profile
class Door
{
public:
Door() {}
void interact()
{
// Open or close the door
m_open = !m_open;
if (m_open)
{
class Player
{
public:
Player() {}
template <typename InteractiveObject>
void interactWith(InteractiveObject *obj)
{
if (obj)
{
class Player
{
public:
Player() {}
void interactWith(InteractiveObject *obj)
{
if (obj)
{
obj->interact();
class Door : public InteractiveObject
{
public:
Door() {}
void interact() override
{
// Open or close the door
m_open = !m_open;
if (m_open)
{
class InteractiveObject
{
public:
virtual void interact() = 0;
virtual ~InteractiveObject() = default;
};
class Door
{
public:
Door() {}
void toggleOpen()
{
// Open or close the door
m_open = !m_open;
if (m_open)
{
class Player
{
public:
Player() {}
void interactWith(Door *door)
{
if (door)
{
door->toggleOpen();
from torch.utils import data
num_epochs = 50
loader_params = {'batch_size': 100, 'shuffle': True, 'num_workers': 6}
dataset = HDF5Dataset('C:/ml/data', recursive=True, load_data=False,
data_cache_size=4, transform=None)
data_loader = data.DataLoader(dataset, **loader_params)
import h5py
import helpers
import numpy as np
from pathlib import Path
import torch
from torch.utils import data
class HDF5Dataset(data.Dataset):
"""Represents an abstract HDF5 dataset.
@branislav1991
branislav1991 / siamese.py
Last active February 24, 2021 19:25
Siamese Network For Discriminating MNIST images
import codecs
import errno
import matplotlib.pyplot as plt
import numpy as np
import os
from PIL import Image
import random
import torch
from torch import nn
from torch import optim