MCPcopy
hub / github.com/WangYueFt/dgcnn / _variable_on_cpu

Function _variable_on_cpu

tensorflow/utils/tf_util.py:12–24  ·  view source on GitHub ↗

Helper to create a Variable stored on CPU memory. Args: name: name of the variable shape: list of ints initializer: initializer for Variable Returns: Variable Tensor

(name, shape, initializer, use_fp16=False, trainable=True)

Source from the content-addressed store, hash-verified

10import tensorflow as tf
11
12def _variable_on_cpu(name, shape, initializer, use_fp16=False, trainable=True):
13 """Helper to create a Variable stored on CPU memory.
14 Args:
15 name: name of the variable
16 shape: list of ints
17 initializer: initializer for Variable
18 Returns:
19 Variable Tensor
20 """
21 with tf.device('/cpu:0'):
22 dtype = tf.float16 if use_fp16 else tf.float32
23 var = tf.get_variable(name, shape, initializer=initializer, dtype=dtype, trainable=trainable)
24 return var
25
26def _variable_with_weight_decay(name, shape, stddev, wd, use_xavier=True):
27 """Helper to create an initialized Variable with weight decay.

Callers 7

conv1dFunction · 0.85
conv2dFunction · 0.85
conv2d_transposeFunction · 0.85
conv3dFunction · 0.85
fully_connectedFunction · 0.85
batch_norm_dist_templateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected