|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"No Temperature\/Synthetic Data\/Discriminator.py","language":"python","identifier":"linear","parameters":"(input_, output_size, scope=None)","argument_list":"","return_statement":"return tf.matmul(input_, tf.transpose(matrix)) + bias_term","docstring":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_summary":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_tokens":["Linear","map",":","output","[","k","]","=","sum_i","(","Matrix","[","k","i","]","*","input_","[","i","]",")","+","Bias","[","k","]","Args",":","input_",":","a","tensor","or","a","list","of","2D","batch","x","n","Tensors",".","output_size",":","int","second","dimension","of","W","[","i","]",".","scope",":","VariableScope","for","the","created","subgraph",";","defaults","to","Linear",".","Returns",":","A","2D","Tensor","with","shape","[","batch","x","output_size","]","equal","to","sum_i","(","input_","[","i","]","*","W","[","i","]",")","where","W","[","i","]","s","are","newly","created","matrices",".","Raises",":","ValueError",":","if","some","of","the","arguments","has","unspecified","or","wrong","shape","."],"function":"def linear(input_, output_size, scope=None):\n '''\n Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.\n '''\n\n shape = input_.get_shape().as_list()\n if len(shape) != 2:\n raise ValueError(\"Linear is expecting 2D arguments: %s\" % str(shape))\n if not shape[1]:\n raise ValueError(\"Linear expects shape[1] of arguments: %s\" % str(shape))\n input_size = shape[1]\n\n # Now the computation.\n with tf.variable_scope(scope or \"SimpleLinear\"):\n matrix = tf.get_variable(\"Matrix\", [output_size, input_size], dtype=input_.dtype)\n bias_term = tf.get_variable(\"Bias\", [output_size], dtype=input_.dtype)\n\n return tf.matmul(input_, tf.transpose(matrix)) + bias_term","function_tokens":["def","linear","(","input_",",","output_size",",","scope","=","None",")",":","shape","=","input_",".","get_shape","(",")",".","as_list","(",")","if","len","(","shape",")","!=","2",":","raise","ValueError","(","\"Linear is expecting 2D arguments: %s\"","%","str","(","shape",")",")","if","not","shape","[","1","]",":","raise","ValueError","(","\"Linear expects shape[1] of arguments: %s\"","%","str","(","shape",")",")","input_size","=","shape","[","1","]","# Now the computation.","with","tf",".","variable_scope","(","scope","or","\"SimpleLinear\"",")",":","matrix","=","tf",".","get_variable","(","\"Matrix\"",",","[","output_size",",","input_size","]",",","dtype","=","input_",".","dtype",")","bias_term","=","tf",".","get_variable","(","\"Bias\"",",","[","output_size","]",",","dtype","=","input_",".","dtype",")","return","tf",".","matmul","(","input_",",","tf",".","transpose","(","matrix",")",")","+","bias_term"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/No Temperature\/Synthetic Data\/Discriminator.py#L12-L38"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"No Temperature\/Synthetic Data\/Discriminator.py","language":"python","identifier":"highway","parameters":"(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway')","argument_list":"","return_statement":"return output","docstring":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_summary":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_tokens":["Highway","Network","(","cf",".","http",":","\/\/","arxiv",".","org","\/","abs","\/","1505",".","00387",")",".","t","=","sigmoid","(","Wy","+","b",")","z","=","t","*","g","(","Wy","+","b",")","+","(","1","-","t",")","*","y","where","g","is","nonlinearity","t","is","transform","gate","and","(","1","-","t",")","is","carry","gate","."],"function":"def highway(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway'):\n \"\"\"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.\n \"\"\"\n\n with tf.variable_scope(scope):\n for idx in range(num_layers):\n g = f(linear(input_, size, scope='highway_lin_%d' % idx))\n\n t = tf.sigmoid(linear(input_, size, scope='highway_gate_%d' % idx) + bias)\n\n output = t * g + (1. - t) * input_\n input_ = output\n\n return output","function_tokens":["def","highway","(","input_",",","size",",","num_layers","=","1",",","bias","=","-","2.0",",","f","=","tf",".","nn",".","relu",",","scope","=","'Highway'",")",":","with","tf",".","variable_scope","(","scope",")",":","for","idx","in","range","(","num_layers",")",":","g","=","f","(","linear","(","input_",",","size",",","scope","=","'highway_lin_%d'","%","idx",")",")","t","=","tf",".","sigmoid","(","linear","(","input_",",","size",",","scope","=","'highway_gate_%d'","%","idx",")","+","bias",")","output","=","t","*","g","+","(","1.","-","t",")","*","input_","input_","=","output","return","output"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/No Temperature\/Synthetic Data\/Discriminator.py#L41-L57"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"No Temperature\/Image COCO\/Discriminator.py","language":"python","identifier":"linear","parameters":"(input_, output_size, scope=None)","argument_list":"","return_statement":"return tf.matmul(input_, tf.transpose(matrix)) + bias_term","docstring":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_summary":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_tokens":["Linear","map",":","output","[","k","]","=","sum_i","(","Matrix","[","k","i","]","*","input_","[","i","]",")","+","Bias","[","k","]","Args",":","input_",":","a","tensor","or","a","list","of","2D","batch","x","n","Tensors",".","output_size",":","int","second","dimension","of","W","[","i","]",".","scope",":","VariableScope","for","the","created","subgraph",";","defaults","to","Linear",".","Returns",":","A","2D","Tensor","with","shape","[","batch","x","output_size","]","equal","to","sum_i","(","input_","[","i","]","*","W","[","i","]",")","where","W","[","i","]","s","are","newly","created","matrices",".","Raises",":","ValueError",":","if","some","of","the","arguments","has","unspecified","or","wrong","shape","."],"function":"def linear(input_, output_size, scope=None):\n '''\n Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.\n '''\n\n shape = input_.get_shape().as_list()\n if len(shape) != 2:\n raise ValueError(\"Linear is expecting 2D arguments: %s\" % str(shape))\n if not shape[1]:\n raise ValueError(\"Linear expects shape[1] of arguments: %s\" % str(shape))\n input_size = shape[1]\n\n # Now the computation.\n with tf.variable_scope(scope or \"SimpleLinear\"):\n matrix = tf.get_variable(\"Matrix\", [output_size, input_size], dtype=input_.dtype)\n bias_term = tf.get_variable(\"Bias\", [output_size], dtype=input_.dtype)\n\n return tf.matmul(input_, tf.transpose(matrix)) + bias_term","function_tokens":["def","linear","(","input_",",","output_size",",","scope","=","None",")",":","shape","=","input_",".","get_shape","(",")",".","as_list","(",")","if","len","(","shape",")","!=","2",":","raise","ValueError","(","\"Linear is expecting 2D arguments: %s\"","%","str","(","shape",")",")","if","not","shape","[","1","]",":","raise","ValueError","(","\"Linear expects shape[1] of arguments: %s\"","%","str","(","shape",")",")","input_size","=","shape","[","1","]","# Now the computation.","with","tf",".","variable_scope","(","scope","or","\"SimpleLinear\"",")",":","matrix","=","tf",".","get_variable","(","\"Matrix\"",",","[","output_size",",","input_size","]",",","dtype","=","input_",".","dtype",")","bias_term","=","tf",".","get_variable","(","\"Bias\"",",","[","output_size","]",",","dtype","=","input_",".","dtype",")","return","tf",".","matmul","(","input_",",","tf",".","transpose","(","matrix",")",")","+","bias_term"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/No Temperature\/Image COCO\/Discriminator.py#L12-L38"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"No Temperature\/Image COCO\/Discriminator.py","language":"python","identifier":"highway","parameters":"(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway')","argument_list":"","return_statement":"return output","docstring":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_summary":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_tokens":["Highway","Network","(","cf",".","http",":","\/\/","arxiv",".","org","\/","abs","\/","1505",".","00387",")",".","t","=","sigmoid","(","Wy","+","b",")","z","=","t","*","g","(","Wy","+","b",")","+","(","1","-","t",")","*","y","where","g","is","nonlinearity","t","is","transform","gate","and","(","1","-","t",")","is","carry","gate","."],"function":"def highway(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway'):\n \"\"\"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.\n \"\"\"\n\n with tf.variable_scope(scope):\n for idx in range(num_layers):\n g = f(linear(input_, size, scope='highway_lin_%d' % idx))\n\n t = tf.sigmoid(linear(input_, size, scope='highway_gate_%d' % idx) + bias)\n\n output = t * g + (1. - t) * input_\n input_ = output\n\n return output","function_tokens":["def","highway","(","input_",",","size",",","num_layers","=","1",",","bias","=","-","2.0",",","f","=","tf",".","nn",".","relu",",","scope","=","'Highway'",")",":","with","tf",".","variable_scope","(","scope",")",":","for","idx","in","range","(","num_layers",")",":","g","=","f","(","linear","(","input_",",","size",",","scope","=","'highway_lin_%d'","%","idx",")",")","t","=","tf",".","sigmoid","(","linear","(","input_",",","size",",","scope","=","'highway_gate_%d'","%","idx",")","+","bias",")","output","=","t","*","g","+","(","1.","-","t",")","*","input_","input_","=","output","return","output"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/No Temperature\/Image COCO\/Discriminator.py#L41-L57"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"Synthetic Data\/Discriminator.py","language":"python","identifier":"linear","parameters":"(input_, output_size, scope=None)","argument_list":"","return_statement":"return tf.matmul(input_, tf.transpose(matrix)) + bias_term","docstring":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_summary":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_tokens":["Linear","map",":","output","[","k","]","=","sum_i","(","Matrix","[","k","i","]","*","input_","[","i","]",")","+","Bias","[","k","]","Args",":","input_",":","a","tensor","or","a","list","of","2D","batch","x","n","Tensors",".","output_size",":","int","second","dimension","of","W","[","i","]",".","scope",":","VariableScope","for","the","created","subgraph",";","defaults","to","Linear",".","Returns",":","A","2D","Tensor","with","shape","[","batch","x","output_size","]","equal","to","sum_i","(","input_","[","i","]","*","W","[","i","]",")","where","W","[","i","]","s","are","newly","created","matrices",".","Raises",":","ValueError",":","if","some","of","the","arguments","has","unspecified","or","wrong","shape","."],"function":"def linear(input_, output_size, scope=None):\n '''\n Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.\n '''\n\n shape = input_.get_shape().as_list()\n if len(shape) != 2:\n raise ValueError(\"Linear is expecting 2D arguments: %s\" % str(shape))\n if not shape[1]:\n raise ValueError(\"Linear expects shape[1] of arguments: %s\" % str(shape))\n input_size = shape[1]\n\n # Now the computation.\n with tf.variable_scope(scope or \"SimpleLinear\"):\n matrix = tf.get_variable(\"Matrix\", [output_size, input_size], dtype=input_.dtype)\n bias_term = tf.get_variable(\"Bias\", [output_size], dtype=input_.dtype)\n\n return tf.matmul(input_, tf.transpose(matrix)) + bias_term","function_tokens":["def","linear","(","input_",",","output_size",",","scope","=","None",")",":","shape","=","input_",".","get_shape","(",")",".","as_list","(",")","if","len","(","shape",")","!=","2",":","raise","ValueError","(","\"Linear is expecting 2D arguments: %s\"","%","str","(","shape",")",")","if","not","shape","[","1","]",":","raise","ValueError","(","\"Linear expects shape[1] of arguments: %s\"","%","str","(","shape",")",")","input_size","=","shape","[","1","]","# Now the computation.","with","tf",".","variable_scope","(","scope","or","\"SimpleLinear\"",")",":","matrix","=","tf",".","get_variable","(","\"Matrix\"",",","[","output_size",",","input_size","]",",","dtype","=","input_",".","dtype",")","bias_term","=","tf",".","get_variable","(","\"Bias\"",",","[","output_size","]",",","dtype","=","input_",".","dtype",")","return","tf",".","matmul","(","input_",",","tf",".","transpose","(","matrix",")",")","+","bias_term"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/Synthetic Data\/Discriminator.py#L12-L38"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"Synthetic Data\/Discriminator.py","language":"python","identifier":"highway","parameters":"(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway')","argument_list":"","return_statement":"return output","docstring":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_summary":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_tokens":["Highway","Network","(","cf",".","http",":","\/\/","arxiv",".","org","\/","abs","\/","1505",".","00387",")",".","t","=","sigmoid","(","Wy","+","b",")","z","=","t","*","g","(","Wy","+","b",")","+","(","1","-","t",")","*","y","where","g","is","nonlinearity","t","is","transform","gate","and","(","1","-","t",")","is","carry","gate","."],"function":"def highway(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway'):\n \"\"\"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.\n \"\"\"\n\n with tf.variable_scope(scope):\n for idx in range(num_layers):\n g = f(linear(input_, size, scope='highway_lin_%d' % idx))\n\n t = tf.sigmoid(linear(input_, size, scope='highway_gate_%d' % idx) + bias)\n\n output = t * g + (1. - t) * input_\n input_ = output\n\n return output","function_tokens":["def","highway","(","input_",",","size",",","num_layers","=","1",",","bias","=","-","2.0",",","f","=","tf",".","nn",".","relu",",","scope","=","'Highway'",")",":","with","tf",".","variable_scope","(","scope",")",":","for","idx","in","range","(","num_layers",")",":","g","=","f","(","linear","(","input_",",","size",",","scope","=","'highway_lin_%d'","%","idx",")",")","t","=","tf",".","sigmoid","(","linear","(","input_",",","size",",","scope","=","'highway_gate_%d'","%","idx",")","+","bias",")","output","=","t","*","g","+","(","1.","-","t",")","*","input_","input_","=","output","return","output"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/Synthetic Data\/Discriminator.py#L41-L57"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"Image COCO\/Discriminator.py","language":"python","identifier":"linear","parameters":"(input_, output_size, scope=None)","argument_list":"","return_statement":"return tf.matmul(input_, tf.transpose(matrix)) + bias_term","docstring":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_summary":"Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.","docstring_tokens":["Linear","map",":","output","[","k","]","=","sum_i","(","Matrix","[","k","i","]","*","input_","[","i","]",")","+","Bias","[","k","]","Args",":","input_",":","a","tensor","or","a","list","of","2D","batch","x","n","Tensors",".","output_size",":","int","second","dimension","of","W","[","i","]",".","scope",":","VariableScope","for","the","created","subgraph",";","defaults","to","Linear",".","Returns",":","A","2D","Tensor","with","shape","[","batch","x","output_size","]","equal","to","sum_i","(","input_","[","i","]","*","W","[","i","]",")","where","W","[","i","]","s","are","newly","created","matrices",".","Raises",":","ValueError",":","if","some","of","the","arguments","has","unspecified","or","wrong","shape","."],"function":"def linear(input_, output_size, scope=None):\n '''\n Linear map: output[k] = sum_i(Matrix[k, i] * input_[i] ) + Bias[k]\n Args:\n input_: a tensor or a list of 2D, batch x n, Tensors.\n output_size: int, second dimension of W[i].\n scope: VariableScope for the created subgraph; defaults to \"Linear\".\n Returns:\n A 2D Tensor with shape [batch x output_size] equal to\n sum_i(input_[i] * W[i]), where W[i]s are newly created matrices.\n Raises:\n ValueError: if some of the arguments has unspecified or wrong shape.\n '''\n\n shape = input_.get_shape().as_list()\n if len(shape) != 2:\n raise ValueError(\"Linear is expecting 2D arguments: %s\" % str(shape))\n if not shape[1]:\n raise ValueError(\"Linear expects shape[1] of arguments: %s\" % str(shape))\n input_size = shape[1]\n\n # Now the computation.\n with tf.variable_scope(scope or \"SimpleLinear\"):\n matrix = tf.get_variable(\"Matrix\", [output_size, input_size], dtype=input_.dtype)\n bias_term = tf.get_variable(\"Bias\", [output_size], dtype=input_.dtype)\n\n return tf.matmul(input_, tf.transpose(matrix)) + bias_term","function_tokens":["def","linear","(","input_",",","output_size",",","scope","=","None",")",":","shape","=","input_",".","get_shape","(",")",".","as_list","(",")","if","len","(","shape",")","!=","2",":","raise","ValueError","(","\"Linear is expecting 2D arguments: %s\"","%","str","(","shape",")",")","if","not","shape","[","1","]",":","raise","ValueError","(","\"Linear expects shape[1] of arguments: %s\"","%","str","(","shape",")",")","input_size","=","shape","[","1","]","# Now the computation.","with","tf",".","variable_scope","(","scope","or","\"SimpleLinear\"",")",":","matrix","=","tf",".","get_variable","(","\"Matrix\"",",","[","output_size",",","input_size","]",",","dtype","=","input_",".","dtype",")","bias_term","=","tf",".","get_variable","(","\"Bias\"",",","[","output_size","]",",","dtype","=","input_",".","dtype",")","return","tf",".","matmul","(","input_",",","tf",".","transpose","(","matrix",")",")","+","bias_term"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/Image COCO\/Discriminator.py#L12-L38"} |
|
{"nwo":"CR-Gjx\/LeakGAN","sha":"dc3360e30f2572cc4d7281cf2c8f490558e4a794","path":"Image COCO\/Discriminator.py","language":"python","identifier":"highway","parameters":"(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway')","argument_list":"","return_statement":"return output","docstring":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_summary":"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.","docstring_tokens":["Highway","Network","(","cf",".","http",":","\/\/","arxiv",".","org","\/","abs","\/","1505",".","00387",")",".","t","=","sigmoid","(","Wy","+","b",")","z","=","t","*","g","(","Wy","+","b",")","+","(","1","-","t",")","*","y","where","g","is","nonlinearity","t","is","transform","gate","and","(","1","-","t",")","is","carry","gate","."],"function":"def highway(input_, size, num_layers=1, bias=-2.0, f=tf.nn.relu, scope='Highway'):\n \"\"\"Highway Network (cf. http:\/\/arxiv.org\/abs\/1505.00387).\n t = sigmoid(Wy + b)\n z = t * g(Wy + b) + (1 - t) * y\n where g is nonlinearity, t is transform gate, and (1 - t) is carry gate.\n \"\"\"\n\n with tf.variable_scope(scope):\n for idx in range(num_layers):\n g = f(linear(input_, size, scope='highway_lin_%d' % idx))\n\n t = tf.sigmoid(linear(input_, size, scope='highway_gate_%d' % idx) + bias)\n\n output = t * g + (1. - t) * input_\n input_ = output\n\n return output","function_tokens":["def","highway","(","input_",",","size",",","num_layers","=","1",",","bias","=","-","2.0",",","f","=","tf",".","nn",".","relu",",","scope","=","'Highway'",")",":","with","tf",".","variable_scope","(","scope",")",":","for","idx","in","range","(","num_layers",")",":","g","=","f","(","linear","(","input_",",","size",",","scope","=","'highway_lin_%d'","%","idx",")",")","t","=","tf",".","sigmoid","(","linear","(","input_",",","size",",","scope","=","'highway_gate_%d'","%","idx",")","+","bias",")","output","=","t","*","g","+","(","1.","-","t",")","*","input_","input_","=","output","return","output"],"url":"https:\/\/github.com\/CR-Gjx\/LeakGAN\/blob\/dc3360e30f2572cc4d7281cf2c8f490558e4a794\/Image COCO\/Discriminator.py#L41-L57"} |