Compressor¶
Gradient Compressors for All-Reduce.
-
class
Compressor(var_op_name)[source]¶ Bases:
abc.ABCWraps CollectiveOps.All_Reduce with compression and decompression for network efficiency.
This means that it only wraps gradient transmission for AllReduce synchronized variables, not PS ops or other ops like network reads.
-
abstract
reduce(tensor: tensorflow.python.framework.ops.Tensor, conf: autodist.kernel.synchronization.compressor.CollectiveOpsConfig)[source]¶ Compress, reduce, and decompress a given tensor.
- Parameters
tensor (Tensor) – the Tensor to reduce.
conf (CollectiveOpsConfig) – the config for Collective Ops.
- Returns
Reduced Tensor
-
abstract
-
class
CompressorEF(var_op_name)[source]¶ Bases:
autodist.kernel.synchronization.compressor.Compressor,abc.ABCA Compressor with Error Feedback.
-
reduce(tensor: tensorflow.python.framework.ops.Tensor, conf: autodist.kernel.synchronization.compressor.CollectiveOpsConfig)[source]¶ Compress, reduce, and decompress a given tensor.
- Parameters
tensor (Tensor) – the Tensor to reduce.
conf (CollectiveOpsConfig) – the config for Collective Ops.
- Returns
Reduced Tensor
-
-
class
NoneCompressor(var_op_name)[source]¶ Bases:
autodist.kernel.synchronization.compressor.CompressorAn identity Compressor.
-
reduce(tensor: tensorflow.python.framework.ops.Tensor, conf: autodist.kernel.synchronization.compressor.CollectiveOpsConfig)[source]¶ Compress, reduce, and decompress a given tensor.
- Parameters
tensor (Tensor) – the Tensor to reduce.
conf (CollectiveOpsConfig) – the config for Collective Ops.
- Returns
Reduced Tensor
-
-
class
HorovodCompressor(var_op_name)[source]¶ Bases:
autodist.kernel.synchronization.compressor.CompressorImplements Horovod’s Compression.
-
reduce(tensor: tensorflow.python.framework.ops.Tensor, conf: autodist.kernel.synchronization.compressor.CollectiveOpsConfig)[source]¶ Compress, reduce, and decompress a given tensor.
- Parameters
tensor (Tensor) – the Tensor to reduce.
conf (CollectiveOpsConfig) – the config for Collective Ops.
- Returns
Reduced Tensor
-
-
class
HorovodCompressorEF(var_op_name)[source]¶ Bases:
autodist.kernel.synchronization.compressor.CompressorEF,autodist.kernel.synchronization.compressor.HorovodCompressorHorovod’s Compression but with Error Feedback.
-
classmethod
create(name, *args, **kwargs)[source]¶ Create new Compressor instance given subclass name.
- Parameters
name – Name of the Compressor subclass (e.g. NoneCompressor).
*args – Any args for the subclass constructor.
**kwargs – Any kwargs for the subclass constructor.
- Returns
Compressor
-
reduce(tensor: tensorflow.python.framework.ops.Tensor, conf: autodist.kernel.synchronization.compressor.CollectiveOpsConfig)[source]¶ Compress, reduce, and decompress a given tensor.
- Parameters
tensor (Tensor) – the Tensor to reduce.
conf (CollectiveOpsConfig) – the config for Collective Ops.
- Returns
Reduced Tensor
-
classmethod