TorchCraftAI
A bot for machine learning research on StarCraft: Brood War
Public Member Functions | Protected Member Functions | List of all members
cherrypi::UnitPresenceFeaturizer Struct Reference

Sparse featurizer for unit presence. More...

#include <unitsfeatures.h>

Inherits cherrypi::UnitAttributeFeaturizer.

Public Member Functions

 UnitPresenceFeaturizer ()
 
- Public Member Functions inherited from cherrypi::UnitAttributeFeaturizer
virtual ~UnitAttributeFeaturizer ()=default
 
virtual Data extract (State *state, UnitsInfo::Units const &units, Rect const &boundingBox=Rect())
 Extract unit features for a given set of units. More...
 
Data extract (State *state, Rect const &boundingBox=Rect())
 Extract unit features for all live units. More...
 
Data extract (State *state, UnitFilter filter, Rect const &boundingBox=Rect())
 Extract unit features for all live units that pass the given filter. More...
 
FeatureData toSpatialFeature (Data const &data, SubsampleMethod pooling=SubsampleMethod::Sum) const
 Embeds the unit attribute data into a spatial feature. More...
 
void toSpatialFeature (FeatureData *dest, Data const &data, SubsampleMethod pooling=SubsampleMethod::Sum) const
 Embeds the unit attribute data into a spatial feature. More...
 

Protected Member Functions

virtual void extractUnit (TensorDest acc, Unit *) override
 Reimplement this in actual featurizers. More...
 

Additional Inherited Members

- Public Types inherited from cherrypi::UnitAttributeFeaturizer
using UnitFilter = std::function< bool(Unit *)>
 
using TensorDest = torch::TensorAccessor< float, 1 >
 
- Public Attributes inherited from cherrypi::UnitAttributeFeaturizer
std::shared_ptr< BaseJitterjitter = std::make_shared<NoJitter>()
 Optional jittering of unit positions. More...
 
CustomFeatureType type
 
std::string name
 
int numChannels
 

Detailed Description

Sparse featurizer for unit presence.

This will produce a binary feature with a single channel: 0 if there is no unit, 1 if there is a unit.

Constructor & Destructor Documentation

cherrypi::UnitPresenceFeaturizer::UnitPresenceFeaturizer ( )
inline

Member Function Documentation

virtual void cherrypi::UnitPresenceFeaturizer::extractUnit ( TensorDest  acc,
Unit unit 
)
inlineoverrideprotectedvirtual

Reimplement this in actual featurizers.

This function is expected to set acc[0], ..., acc[numChannels-1]

Implements cherrypi::UnitAttributeFeaturizer.


The documentation for this struct was generated from the following file: