labels = np.array([[1.0], [2.0]])
with self.test_session() as session:
+ # Add another trainable variable that doesn't produce a gradient to
+ # verify that None gradients are supported.
+ _ = variable_scope.get_variable(
+ 'another_variable',
+ initializer=constant_op.constant(1, dtype=dtypes.float64),
+ dtype=dtypes.float64)
+
replicated_model_fn = replicate_model_fn.replicate_model_fn(
self.model_fn, losses.Reduction.MEAN, devices=['/gpu:0', '/gpu:1'])
estimator_spec = replicated_model_fn(
feature_shards, label_shards = replicate_model_fn._split_batch(
features, labels, 2, device='/gpu:0')
- print(feature_shards[0]['x'].eval())
- print(feature_shards[1]['x'].eval())
self.assertSparseValuesEqual(
sparse_tensor.SparseTensorValue(
indices=[[0, 0], [1, 0], [1, 1]],