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 time | |
def loss_i(x_i, y, W): | |
delta = 1 | |
scores_i = np.dot(W, x_i) | |
margin = 0 | |
for j in range(scores_i.shape[0]): | |
if j == y: |
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
struct Position { | |
var x: Int = 0 | |
var y: Int = 0 | |
func string() -> String { | |
return "(\(x), \(y))" | |
} | |
} | |
// CustomStringConvertible provides "description" property. |
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
std::vector<SourceFile*> static_files = this->_source.static_files(); | |
for (auto it_file = static_files.begin(); it_file != static_files.end(); ++it_file) { | |
// for (auto it_file = this->_source.static_files().begin(); it_file != this->_source.static_files().end(); ++it_file) { |
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 Foundation | |
class AsyncBlockOperation: NSOperation { | |
typealias Block = (Void -> Void) -> Void | |
private let block: Block | |
private var _executing = false | |
private var _finished = false | |
init(block: Block) { |
OlderNewer