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
pub fn decode_nv_list_embedded(xdr: &mut xdr::Xdr) -> xdr::XdrResult<NvList> { | |
// Decode version and nvflag | |
let version = try!(xdr.decode_i32()); | |
let nvflag = try!(xdr.decode_u32()); | |
// TODO: Give an actual error | |
if version != NV_VERSION { | |
return Err(xdr::XdrError); | |
} |
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
static int | |
nvs_xdr_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size) | |
{ | |
XDR *xdr = nvs->nvs_private; | |
int32_t encode_len, decode_len; | |
switch (nvs->nvs_op) { | |
case NVS_OP_ENCODE: { | |
size_t nvsize; |
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
/* | |
* CDDL HEADER START | |
* | |
* The contents of this file are subject to the terms of the | |
* Common Development and Distribution License (the "License"). | |
* You may not use this file except in compliance with the License. | |
* | |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
* or http://www.opensolaris.org/os/licensing. | |
* See the License for the specific language governing permissions |
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 requests | |
import socket, os | |
from http.server import HTTPServer | |
from http.server import BaseHTTPRequestHandler | |
import ssl | |
from util import text_image, get_random_image_path, get_user_name,\ | |
make_fake_ride_request, get_ride_info, change_ride_status | |
from pages import success_page |
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
pub struct Node { | |
pub inputs: Vec<VarIndex>, | |
pub outputs: Vec<VarIndex>, | |
pub in_grad: Vec<VarIndex>, // gradients on inputs | |
pub out_grad: Vec<OutGrad>, // gradients on outputs | |
} |
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
pub struct Graph { | |
nodes: Vec<Node>, | |
node_ops: Vec<Box<Operation>>, | |
pub var_store: VarStore, | |
out_var_map: HashMap<VarIndex, (NodeIndex, usize)>, // Maps output variable to it's node and index within node | |
// Gradients on variables that are inputs to the graph - they have no corresponding node | |
in_var_grad: HashMap<VarIndex, OutGrad>, | |
} | |
impl Graph { |
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
pub struct MatMul { | |
a_t: ClMatrix<f32>, | |
b_t: ClMatrix<f32>, | |
} | |
impl MatMul { | |
pub fn new(ctx: &matrix::Context, a_shape: (u64, u64), b_shape: (u64, u64)) -> Self { | |
MatMul { | |
a_t: ClMatrix::new(ctx, a_shape.1 as usize, a_shape.0 as usize, ClMatrixMode::Mut), | |
b_t: ClMatrix::new(ctx, b_shape.1 as usize, b_shape.0 as usize, ClMatrixMode::Mut), |
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
extern crate deeplearn; | |
extern crate matrix; | |
use deeplearn::Graph; | |
use deeplearn::op::{MatMul, Relu}; | |
fn main() { | |
let ctx = matrix::Context::new(); | |
// Setup the graph |
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
let l1_mat_mul = graph.add_node(&ctx, | |
Box::new(MatMul::new(&ctx, (1, 2), (2, 3))), | |
vec![a, l1_w], | |
&[(1, 3)]); |
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
let mat_mul = graph.add_node(MatMul(input, weights)); |
OlderNewer