This file contains hidden or 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
class ImbalancedDatasetSampler(torch.utils.data.sampler.Sampler): | |
"""Samples elements randomly from a given list of indices for imbalanced dataset | |
Arguments: | |
indices (list, optional): a list of indices | |
num_samples (int, optional): number of samples to draw | |
Source : https://github.com/ufoym/imbalanced-dataset-sampler [UPDATED for CustomDataset] | |
""" | |
def __init__(self, dataset: object, indices=None, num_samples=None) -> object: |
This file contains hidden or 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
from functools import partial | |
from typing import Optional | |
import torch | |
import torch.nn.functional as F | |
from torch.nn.modules.loss import _Loss | |
#: Loss binary mode suppose you are solving binary segmentation task. | |
#: That mean yor have only one class which pixels are labled as **1**, | |
#: the rest pixels are background and labeled as **0**. |
This file contains hidden or 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
#include <iostream> | |
#include <memory> | |
#include <exception> | |
#include <vector> | |
#include <climits> | |
#ifdef _MSC_VER | |
#define _NOEXCEPT noexcept | |
#else | |
#define _NOEXCEPT noexcept |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
typedef struct point2D { | |
int x, y; | |
}point2D; | |
typedef struct line2D { | |
point2D *start; |
This file contains hidden or 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
#include <bits/stdc++.h> | |
using namespace std; | |
string isBalanced(string s) { | |
std::vector<char> stack; | |
bool flag = false; | |
for(int i = 0; (i < s.length()) && !flag; i++){ | |
switch(s[i]){ |
This file contains hidden or 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
#include <cmath> | |
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
class max_stack { | |
public: | |
max_stack(void); |
This file contains hidden or 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
#include <iostream> | |
#include <cstring> | |
#include <vector> | |
#include <algorithm> | |
#include <stdio.h> | |
std::vector<int> shift_array(std::string str) { | |
int len = str.length(); | |
int i = 0, j = 1; |
This file contains hidden or 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
#include <map> | |
#include <set> | |
#include <list> | |
#include <cmath> | |
#include <ctime> | |
#include <deque> | |
#include <queue> | |
#include <stack> | |
#include <string> | |
#include <bitset> |
This file contains hidden or 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
sudo -i | |
mkdir aws | |
cd aws | |
wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip | |
unzip awscli-bundle.zip | |
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws | |
aws configure set aws_access_key_id your_access_key | |
aws configure set aws_secret_access your_secret_access | |
echo "AWS-CLI Done" |
This file contains hidden or 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
#include "Trie.h" | |
Node::Node() { | |
this->ch = ' '; | |
this->isLeaf = false; | |
this->str = ""; | |
this->children = std::vector<Node*>(ALPHABET_SIZE, NULL); | |
} | |
Node::~Node() { |
NewerOlder